Ignore:
Timestamp:
Dec 8, 2009 7:53:25 AM (14 years ago)
Author:
piv
Message:

merge from plone 2.1 branch: r2465-2483

Location:
quintagroup.transmogrifier/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.transmogrifier/trunk

    • Property svn:mergeinfo changed from /quintagroup.transmogrifier/branches/plone-2.1/quintagroup.transmogrifier:1387-1389,1394-1413 to /quintagroup.transmogrifier/branches/plone-2.1/quintagroup.transmogrifier:1387-1389,1394-1413,1426-1444
  • quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/binary.txt

    r453 r1446  
    1717section. 
    1818 
     19Also this section provides condition option which, if specified, exports/imports 
     20this or another binary field only if condition expression evaluates to true. 
     21 
    1922>>> import pprint 
    2023>>> binary = """ 
     
    3235... [fileexporter] 
    3336... blueprint = quintagroup.transmogrifier.fileexporter 
     37... condition = python:fname != 'image' 
    3438...  
    3539... [dataprinter] 
     
    5862                            'name': '.file-fields.xml'}}, 
    5963 '_path': 'spam/eggs/foo'} 
    60 <?xml version="1.0" ?> 
     64<?xml version="1.0" encoding="utf-8"?> 
    6165<manifest> 
    6266  <field name="file"> 
    63     <filename>archive.tar.gz</filename> 
    64     <mimetype>application/x-tar</mimetype> 
     67    <filename> 
     68      archive.tar.gz 
     69    </filename> 
     70    <mimetype> 
     71      application/x-tar 
     72    </mimetype> 
    6573  </field> 
    6674</manifest> 
     
    7078 
    7179TODO: write test for getting data for fields from import context 
     80 
     81The ``condition`` expression hass access to the following: 
     82 
     83=================== ========================================================== 
     84 ``item``            the current pipeline item 
     85 ``transmogrifier``  the transmogrifier 
     86 ``name``            the name of the splitter section 
     87 ``options``         the splitter options 
     88 ``modules``         sys.modules 
     89 ``context``         the current content object 
     90 ``fname``           the name of the field being processed 
     91 ``filename``        the file name binary field is loaded into (import only) 
     92 ``data``            data read from the file (import only) 
     93 ``mimetype``        data mimetype (import only) 
     94=================== ========================================================== 
Note: See TracChangeset for help on using the changeset viewer.