source: cmfdeployment/branches/kenw-p4-wip/segments/source.py @ 2380

Last change on this file since 2380 was 2380, checked in by kenw, 8 years ago

Committing new branch intended for Plone 4 compatibility; mostly required imports of new zope packages

File size: 1.4 KB
Line 
1"""
2$Id: source.py 1135 2006-01-20 10:20:40Z hazmat $
3"""
4
5from Products.CMFDeployment import DefaultConfiguration
6from Products.ZCatalog.CatalogBrains import AbstractCatalogBrain
7
8from core import Producer
9
10class ContentSource( Producer ):
11
12    def process( self, pipe, ctxobj ):
13        for source in pipe.services["ContentIdentification"].sources.objectValues():
14            for content in source.getContent():
15                if isinstance( content, AbstractCatalogBrain ):
16                    content = content.getObject()
17
18                if content is None:
19                    #print "egads",  source, content
20                    continue
21
22                yield content
23
24        dependency_source = pipe.services['DeploymentPolicy']._getOb(
25            DefaultConfiguration.DependencySource, None )
26
27        if dependency_source is None:
28            raise StopIteration
29
30        for content in dependency_source.getContent():
31            if content is None:
32                #print "bad dep"
33                continue
34            yield content
35
36class ContentDeletion( Producer ):
37
38    def process( self, pipe, ctxobj ):
39       
40        source = pipe.services['DeploymentPolicy']._getOb(
41            DefaultConfiguration.DeletionSource, None
42            )
43
44        if source is None:
45            raise StopIteration
46
47        for record in source.getContent():
48            yield record
49           
Note: See TracBrowser for help on using the repository browser.