Changeset 1392 in products


Ignore:
Timestamp:
Nov 24, 2009 10:45:53 AM (14 years ago)
Author:
piv
Message:

make it work for plone 2.1 in case we have directory import context

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.transmogrifier/branches/plone-2.1/quintagroup.transmogrifier/quintagroup/transmogrifier/exportimport.py

    r690 r1392  
     1import os 
    12import tempfile 
    23 
     
    8687 
    8788def importSiteStructure(context): 
    88     # this function is also called when adding Plone site, so call standard handler 
    89     if not context.readDataFile('.objects.xml', subdir='structure'): 
    90         try: 
    91             from Products.GenericSetup.interfaces import IFilesystemImporter 
    92             IFilesystemImporter(context.getSite()).import_(context, 'structure', True) 
    93         except ImportError: 
    94             pass 
    95         return 
    96  
    9789    transmogrifier = ITransmogrifier(context.getSite()) 
    9890 
     
    109101    transmogrifier._data = {} 
    110102 
     103    # this function is also called when adding Plone site, so call standard handler 
     104    path = '' 
     105    if 'reader' in transmogrifier._raw: 
     106        path = transmogrifier._raw['reader'].get('path', '') 
     107    if not context.readDataFile('.objects.xml', subdir=os.path.join(path, 'structure')): 
     108        try: 
     109            from Products.GenericSetup.interfaces import IFilesystemImporter 
     110            IFilesystemImporter(context.getSite()).import_(context, 'structure', True) 
     111        except ImportError: 
     112            pass 
     113        return 
     114 
    111115    options = transmogrifier._raw['transmogrifier'] 
    112116    sections = options['pipeline'].splitlines() 
     
    118122    # tarball replace it with given function argument 
    119123    while hasattr(last_section, 'previous'): 
    120         if isinstance(last_section, ReaderSection) and \ 
    121             isinstance(last_section.import_context, gscontext.TarballImportContext): 
    122             last_section.import_context = context 
    123124        last_section = last_section.previous 
    124125        # end cycle if we get empty starter section 
Note: See TracChangeset for help on using the changeset viewer.