1 | Site walker source section |
---|
2 | ========================== |
---|
3 | |
---|
4 | A Plone site walker source pipeline section lets you create pipeline items from |
---|
5 | contents of Plone site folders. The site walker source section blueprint name is |
---|
6 | ``quitagroup.transmogrifier.sitewalker``. |
---|
7 | |
---|
8 | A site walker source section will recurse through site's content tree, starting |
---|
9 | form folder, which is the context of transmogrifier, and will yield an item for |
---|
10 | each content object. For folder it will also add a tuple of (id, portal_type) |
---|
11 | pairs of contained items. |
---|
12 | |
---|
13 | You can also specify an optional ``condition`` option; if given, content object |
---|
14 | is 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 | |
---|
46 | The ``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 | =================== ========================================================== |
---|