Beispiel #1
0
def _makeFolder(id, site_folder=False):
    from Products.CMFCore.PortalFolder import PortalFolder
    from Products.CMFCore.TypesTool import TypesTool
    from Products.CMFCore.tests.base.dummy import DummyType

    class _TypeInfo(DummyType):
        def _getId(self):
            return self._id
        def constructInstance(self, container, id, *args, **kw):
            portal_type = self._getId()
            if portal_type == TEST_FOLDER:
                content = PortalFolder(id)
            elif portal_type == TEST_CONTENT:
                content = _makeItem()
                content._setId(id)
            elif portal_type == TEST_INI_AWARE:
                content = _makeINIAware(id)
            elif portal_type == TEST_CSV_AWARE:
                content = _makeCSVAware(id)
            else:
                raise ValueError, 'Ugh'
            content.portal_type = portal_type
            container._setObject(id, content)
            return container._getOb(id)

    folder = PortalFolder(id)
    folder.portal_type = TEST_FOLDER
    if site_folder:
        tool = folder.portal_types = TypesTool()
        tool._setObject(TEST_CSV_AWARE, _TypeInfo(TEST_CSV_AWARE))
        tool._setObject(TEST_INI_AWARE, _TypeInfo(TEST_INI_AWARE))
        tool._setObject(TEST_CONTENT, _TypeInfo(TEST_CONTENT))
        tool._setObject(TEST_FOLDER, _TypeInfo(TEST_FOLDER))

    return folder
Beispiel #2
0
def _makeFolder(id, site_folder=False):
    from Products.CMFCore.PortalFolder import PortalFolder
    from Products.CMFCore.TypesTool import TypesTool
    from Products.CMFCore.tests.base.dummy import DummyType

    class _TypeInfo(DummyType):
        def _getId(self):
            return self._id
        def constructInstance(self, container, id, *args, **kw):
            portal_type = self._getId()
            if portal_type == TEST_FOLDER:
                content = PortalFolder(id)
            elif portal_type == TEST_CONTENT:
                content = _makeItem()
                content._setId(id)
            elif portal_type == TEST_INI_AWARE:
                content = _makeINIAware(id)
            elif portal_type == TEST_CSV_AWARE:
                content = _makeCSVAware(id)
            else:
                raise ValueError, 'Ugh'
            content.portal_type = portal_type
            container._setObject(id, content)
            return container._getOb(id)

    folder = PortalFolder(id)
    folder.portal_type = TEST_FOLDER
    if site_folder:
        tool = folder.portal_types = TypesTool()
        tool._setObject(TEST_CSV_AWARE, _TypeInfo(TEST_CSV_AWARE))
        tool._setObject(TEST_INI_AWARE, _TypeInfo(TEST_INI_AWARE))
        tool._setObject(TEST_CONTENT, _TypeInfo(TEST_CONTENT))
        tool._setObject(TEST_FOLDER, _TypeInfo(TEST_FOLDER))

    return folder
Beispiel #3
0
 def constructInstance(self, container, id, *args, **kw):
     portal_type = self._getId()
     if portal_type == TEST_FOLDER:
         content = PortalFolder(id)
     elif portal_type == TEST_CONTENT:
         content = _makeItem()
         content._setId(id)
     elif portal_type == TEST_INI_AWARE:
         content = _makeINIAware(id)
     elif portal_type == TEST_CSV_AWARE:
         content = _makeCSVAware(id)
     else:
         raise ValueError, 'Ugh'
     content.portal_type = portal_type
     container._setObject(id, content)
     return container._getOb(id)
Beispiel #4
0
 def constructInstance(self, container, id, *args, **kw):
     portal_type = self._getId()
     if portal_type == TEST_FOLDER:
         content = PortalFolder(id)
     elif portal_type == TEST_CONTENT:
         content = _makeItem()
         content._setId(id)
     elif portal_type == TEST_INI_AWARE:
         content = _makeINIAware(id)
     elif portal_type == TEST_CSV_AWARE:
         content = _makeCSVAware(id)
     else:
         raise ValueError, 'Ugh'
     content.portal_type = portal_type
     container._setObject(id, content)
     return container._getOb(id)