Changeset 1604 in products
- Timestamp:
- Jan 29, 2010 12:47:24 PM (14 years ago)
- Location:
- quintagroup.transmogrifier/branches/ofs/quintagroup/transmogrifier
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.transmogrifier/branches/ofs/quintagroup/transmogrifier/configure.zcml
r1602 r1604 137 137 138 138 <utility 139 component=".constructor.ConstructorSection" 140 name="quintagroup.transmogrifier.extendedconstructor" 141 /> 142 143 <utility 139 144 component=".ofsmanager.OFSExporterSection" 140 145 name="quintagroup.transmogrifier.ofsexporter" 141 146 /> 147 148 <utility 149 component=".utilities.FileFTIUtility" 150 provides=".interfaces.IFTIConstructor4MetaType" 151 name="File" 152 /> 153 154 <utility 155 component=".utilities.ImageFTIUtility" 156 provides=".interfaces.IFTIConstructor4MetaType" 157 name="Image" 158 /> 159 142 160 143 161 <adapter factory=".portlets.PortletAssignmentExportImportHandler" /> -
quintagroup.transmogrifier/branches/ofs/quintagroup/transmogrifier/constructor.py
r1598 r1604 1 1 from zope.interface import classProvides, implements 2 from zope.component import queryUtility 2 3 from collective.transmogrifier.interfaces import ISectionBlueprint 3 4 from collective.transmogrifier.interfaces import ISection … … 6 7 from Acquisition import aq_base 7 8 from Products.CMFCore.utils import getToolByName 9 10 from quintagroup.transmogrifier.interfaces import IFTIConstructor4MetaType 8 11 9 12 class ConstructorSection(object): … … 19 22 ('portal_type', 'Type')) 20 23 self.pathkey = defaultMatcher(options, 'path-key', name, 'path') 24 self.meta_types = filter(None, [i.strip() for i in 25 options.get('meta-types', '').splitlines()]) 21 26 22 27 def __iter__(self): … … 33 38 fti = self.ttool.getTypeInfo(type_) 34 39 if fti is None: # not an existing type 35 yield item; continue 36 40 # Look for an IFTIConstructor4MetaType adapter 41 mt = type_.startswith("meta_type:") and type_[10:] or None 42 if mt in self.meta_types: 43 fti = queryUtility(IFTIConstructor4MetaType, name=mt) 44 if fti is None: 45 yield item; continue 46 37 47 elems = path.strip('/').rsplit('/', 1) 38 48 container, id = (len(elems) == 1 and ('', elems[0]) or elems) … … 40 50 if context is None: # container doesn't exist 41 51 yield item; continue 42 52 43 53 if getattr(aq_base(context), id, None) is not None: # item exists 44 54 yield item; continue 45 55 46 56 obj = fti._constructInstance(context, id) 47 57 obj = fti._finishConstruction(obj) 48 58 if obj.getId() != id: 49 59 item[pathkey] = '%s/%s' % (container, obj.getId()) 50 60 51 61 yield item -
quintagroup.transmogrifier/branches/ofs/quintagroup/transmogrifier/import.cfg
r1568 r1604 23 23 .interfaces.xml = interfaces 24 24 .portlets.xml = portlets 25 .file-properties.xml = file-properties 25 26 26 27 [manifestimporter] … … 28 29 29 30 [constructor] 30 blueprint = collective.transmogrifier.sections.constructor31 blueprint = quintagroup.transmogrifier.extendedconstructor 31 32 32 33 [datacorrector] -
quintagroup.transmogrifier/branches/ofs/quintagroup/transmogrifier/interfaces.py
r277 r1604 16 16 """ Correct data given in 'data' argument and return it. 17 17 """ 18 19 class IFTIConstructor4MetaType(Interface): 20 """FTI utility analogy for constuct instance for not CMF objects""" 21 22 def _constructInstance(self, container, id, *args, **kw): 23 """Build a bare instance of the appropriate type. 24 Does not do any security checks. 25 Returns the object without calling _finishConstruction(). 26 """ 27 28 def _finishConstruction(obj): 29 """Finish the construction of a content object. 30 Set its portal_type, insert it into the workflows. 31 """
Note: See TracChangeset
for help on using the changeset viewer.