Conjunto de mudanças 1265 no repositório publico


Ignorar:
Timestamp:
09/11/2005 11:13:25 (14 anos atrás)
Autor:
brunopinheiro
Mensagem:

Modificado script de instalação de módulos externos.

Arquivo:
1 editado

Legenda:

Não Modificado
Adicionado
Removido
  • ILSAALMaterial/trunk/Extensions/InstallPublic.py

    r1197 r1265  
    1212except ImportError:
    1313    from Products.Archetypes.public import listTypes
     14from Products.Archetypes import types_globals
     15
     16
     17
    1418
    1519def install_public(self, externals):
     
    2226                 values,
    2327                 PROJECTNAME)
    24    
     28
    2529    product_skins_dir = 'skins'
    2630
    27     """
    2831    skinstool = getToolByName(self, 'portal_skins')
    29 
    3032    registerDirectory(product_skins_dir, product_globals)
    3133    addDirectoryViews(skinstool, product_skins_dir, product_globals)
    32     """
    33     install_subskin(self, out, product_globals, product_skins_dir)
    3434
    35 
    36 
    37 
    38 def install_subskin(self, out, globals=types_globals, product_skins_dir='skins'):
    39     skinstool=getToolByName(self, 'portal_skins')
    40 
    41     fullProductSkinsPath = os.path.join(package_home(globals), product_skins_dir)
    42     productSkinsPath = minimalpath(fullProductSkinsPath)
    43     registered_directories = manage_listAvailableDirectories()
    44     if productSkinsPath not in registered_directories:
    45         try:
    46             registerDirectory(product_skins_dir, globals)
    47         except OSError, ex:
    48             if ex.errno == 2: # No such file or directory
    49                 return
    50             raise
    51     try:
    52         addDirectoryViews(skinstool, product_skins_dir, globals)
    53     except BadRequestException, e:
    54         # XXX: find a better way to do this, but that seems not feasible
    55         #      until Zope stops using string exceptions
    56         if str(e).endswith(' is reserved.'):
    57             # trying to use a reserved identifier, let the user know
    58             #
    59             # remember the cmf reserve ids of objects in the root of the
    60             # portal !
    61             raise
    62         # directory view has already been added
    63         pass
    64 
    65     files = os.listdir(fullProductSkinsPath)
    66     for productSkinName in files:
    67         # skip directories with a dot or special dirs
    68         # or maybe just startswith('.')?
    69         if productSkinName.find('.') != -1 or productSkinName in ('CVS', '{arch}'):
    70             continue
    71         if isdir(join(fullProductSkinsPath, productSkinName)):
    72             for skinName in skinstool.getSkinSelections():
    73                 path = skinstool.getSkinPath(skinName)
    74                 path = [i.strip() for i in  path.split(',')]
    75                 try:
    76                     if productSkinName not in path:
    77                         path.insert(path.index('custom') +1, productSkinName)
    78                 except ValueError:
    79                     if productSkinName not in path:
    80                         path.append(productSkinName)
    81                 path = ','.join(path)
    82                 skinstool.addSkinSelection(skinName, path)
    83 
Note: Veja TracChangeset para ajuda no uso do visualizador de conjunto de mudanças.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.