Changeset 1321

Show
Ignore:
Timestamp:
10/10/08 14:44:31
Author:
koval
Message:

fixed bug in reader section, added logging section, other little changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • quintagroup.transmogrifier/trunk/TODO.txt

    r1320 r1321  
    22==== 
    33 
    4 - Reference fields aren't imported now, fix it. 
     4- Reference fields can't be imported now, fix it. 
    55 
    66- Make cleaning in manifest export/import sections. 
    77 
    8 - Create tests for ``datacorrector`` adapters, and GS Content steps. 
     8- Create tests for ``datacorrector`` adapters and GS Content steps. 
    99 
    10 - Import doesn't work now for some reason
     10- Rewrite FileExporter/FileImporter adapters as pipeline sections
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/comments.py

    r1319 r1321  
    66from Products.CMFCore import utils 
    77from Products.CMFDefault import DiscussionItem 
     8from Products.CMFDefault.exceptions import DiscussionNotAllowed 
    89 
    910from collective.transmogrifier.interfaces import ISection, ISectionBlueprint 
     
    112113            if not (pathkey and fileskey): 
    113114                yield item; continue 
     115 
    114116            if 'comments' not in item[fileskey]: 
    115117                yield item; continue 
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/configure.zcml

    r1319 r1321  
    4545 
    4646    <utility 
    47         component=".discussioncontainer.CommentsExporterSection" 
     47        component=".comments.CommentsExporterSection" 
    4848        name="quintagroup.transmogrifier.commentsexporter" 
    4949        /> 
    5050 
    5151    <utility 
    52         component=".discussioncontainer.CommentsImporterSection" 
     52        component=".comments.CommentsImporterSection" 
    5353        name="quintagroup.transmogrifier.commentsimporter" 
    5454        /> 
     
    8585        component=".xslt.XSLTSection" 
    8686        name="quintagroup.transmogrifier.xslt" 
     87        /> 
     88 
     89    <utility 
     90        component=".logger.LoggerSection" 
     91        name="quintagroup.transmogrifier.logger" 
    8792        /> 
    8893 
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/export.cfg

    r1319 r1321  
    88    datacorrector 
    99    writer 
     10    EXPORTING 
    1011 
    1112[sitewalker] 
     
    3334blueprint = quintagroup.transmogrifier.writer 
    3435prefix = structure 
     36 
     37[EXPORTING] 
     38blueprint = quintagroup.transmogrifier.logger 
     39keys =  
     40    _type 
     41    _path 
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/import.cfg

    r1320 r1321  
    88    propertiesimporter 
    99    commentsimporter 
     10    IMPORTING 
    1011 
    1112[reader] 
    1213blueprint = quintagroup.transmogrifier.reader 
    1314prefix = structure 
     15.objects.xml = manifest 
     16.marshall.xml = marshall 
     17.properties.xml = propertymanager 
     18.comments.xml = comments 
    1419 
    1520[manifestimport] 
     
    3338[commentsimporter] 
    3439blueprint = quintagroup.transmogrifier.commentsimporter 
     40 
     41[IMPORTING] 
     42blueprint = quintagroup.transmogrifier.logger 
     43keys =  
     44    _type 
     45    _path 
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/manifest.txt

    r1314 r1321  
    11Manifest section 
    22================ 
     3 
     4A manifest section is used to create listing in XML format of all objects 
     5contained in some folder. Manifest section blueprint name is  
     6``quintagroup.transmogrifier.manifest``. 
    37 
    48>>> manifest = """ 
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/patches.py

    r1320 r1321  
    7171            continue 
    7272        # directories have trailing '/' character and we need to remove it 
    73         name.rstrip('/') 
     73        name = name.rstrip('/') 
    7474        names.append(name) 
    7575 
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/propertymanager.py

    r1318 r1321  
    9595 
    9696        self.helper = Helper() 
     97        self.helper._encoding = 'utf-8' 
    9798 
    9899    def __iter__(self): 
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/reader.py

    r1314 r1321  
    99from Products.CMFCore import utils 
    1010 
    11 FILENAME_TO_SECTION = { 
    12     '.objects.xml': 'manifest', 
    13     '.marshall.xml': 'marshall', 
    14     '.properties.xml': 'propertymanager', 
    15     '.comments.xml': 'discussioncontainer' 
    16 } 
    17  
    1811class ReaderSection(object): 
    1912    classProvides(ISectionBlueprint) 
     
    2316        self.previous = previous 
    2417        self.context = transmogrifier.context 
     18        self.options = options 
    2519 
    2620        self.pathkey = options.get('path-key', '_path').strip() 
     
    7064            full_name = os.path.join(top, name) 
    7165            if self.import_context.isDirectory(full_name): continue 
    72             section = FILENAME_TO_SECTION.get(name, name
     66            section = self.options.get(name, name).strip(
    7367            files = item.setdefault(self.fileskey, {}) 
    7468            files[section] = { 
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/reader.txt

    r1314 r1321  
    1919to generated item's path. 
    2020 
     21Reader reads files and adds to ``item[files-key]`` dictionary with file's data 
     22and name. This dictionary is stored on a key, that identifies to which section 
     23this file corresponds. Mapping between filenames and sections is defined in 
     24reader section options. Option name is filename and option value is section name. 
     25 
    2126>>> reader = """ 
    2227... [transmogrifier] 
     
    2833... blueprint = quintagroup.transmogrifier.reader 
    2934... prefix = structure 
     35... .objects.xml = manifest 
     36... .marshall.xml = marshall 
     37... .properties.xml = propertymanager 
     38... .comments.xml = comments 
    3039...  
    3140... [printer] 
     
    4756 '_import_context': <Tarball ...>, 
    4857 '_path': 'pages'} 
    49 {'_files': {'discussioncontainer': {'data': 'some data', 
    50                                     'name': '.comments.xml'}, 
     58{'_files': {'comments': {'data': 'some data', 'name': '.comments.xml'}, 
    5159            'marshall': {'data': 'some data', 'name': '.marshall.xml'}}, 
    5260 '_import_context': <Tarball ...>, 
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/tests.py

    r1319 r1321  
    757757            setUp=propertyManagerSetUp, tearDown=tearDown), 
    758758        doctest.DocFileSuite( 
    759             'discussioncontainer.txt', 
     759            'comments.txt', 
    760760            setUp=commentsSetUp, tearDown=tearDown), 
    761761        doctest.DocFileSuite( 
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/writer.py

    r1314 r1321  
    5454 
    5555            item_path = os.path.join(self.prefix, path) 
    56             item_path.rstrip('/') 
     56            item_path = item_path.rstrip('/') 
    5757 
    5858            for k, v in item[fileskey].items():