source: products/quintagroup.transmogrifier/trunk/quintagroup/transmogrifier/sitewalker.txt @ 1589

Last change on this file since 1589 was 1446, checked in by piv, 14 years ago

merge from plone 2.1 branch: r2465-2483

File size: 2.0 KB
Line 
1Site walker source section
2==========================
3
4A Plone site walker source pipeline section lets you create pipeline items from
5contents of Plone site folders. The site walker source section blueprint name is
6``quitagroup.transmogrifier.sitewalker``.
7
8A site walker source section will recurse through site's content tree, starting
9form folder, which is the context of transmogrifier, and will yield an item for
10each content object. For folder it will also add a tuple of (id, portal_type)
11pairs of contained items.
12
13You can also specify an optional ``condition`` option; if given, content object
14is going into pipeline only if the condition, which is also a TALES is true.
15
16>>> sitewalker = """
17... [transmogrifier]
18... pipeline =
19...     sitewalker
20...     printer
21...
22... [sitewalker]
23... blueprint = quintagroup.transmogrifier.sitewalker
24... condition = python:context.getPortalTypeName() not in ('File', 'Image')
25...
26... [printer]
27... blueprint = collective.transmogrifier.sections.tests.pprinter
28... """
29>>> registerConfig(u'quintagroup.transmogrifier.tests.sitewalker',
30...                sitewalker)
31>>> transmogrifier(u'quintagroup.transmogrifier.tests.sitewalker')
32{'_entries': (('document1', 'Document'),
33              ('folder1', 'Folder'),
34              ('document3', 'Document')),
35 '_path': '',
36 '_type': 'MockPortal'}
37{'_type': 'Document', '_path': 'document1'}
38{'_entries': (('folder2', 'Folder'), ('document2', 'Document')),
39 '_path': 'folder1',
40 '_type': 'Folder'}
41{'_type': 'Folder', '_path': 'folder1/folder2'}
42{'_type': 'Document', '_path': 'folder1/document2'}
43{'_type': 'Document', '_path': 'document3'}
44
45
46The ``condition`` expression has an access to the following:
47
48=================== ==========================================================
49 ``context``         the current content object
50 ``transmogrifier``  the transmogrifier
51 ``name``            the name of the splitter section
52 ``options``         the splitter options
53 ``modules``         sys.modules
54=================== ==========================================================
Note: See TracBrowser for help on using the repository browser.