コード例 #1
0
    def test_no_validate_on_parent(self):
        # Does nothing if no constraints are provided
        from zope.container.constraints import checkFactory

        class Factory(object):
            def getInterfaces(self):
                return {}

        result = checkFactory({}, 'name', Factory())
        self.assertTrue(result)
コード例 #2
0
    def addingInfo(self):
        """Return menu data.

        This is sorted by title.
        """
        container = self.context
        result = []
        for menu_id in (self.menu_id, 'zope.app.container.add'):
            if not menu_id:
                continue
            for item in getMenu(menu_id, self, self.request):
                extra = item.get('extra')
                if extra:
                    factory = extra.get('factory')
                    if factory:
                        factory = getUtility(IFactory, factory)
                        if not checkFactory(container, None, factory):
                            continue
                        elif item['extra']['factory'] != item['action']:
                            item['has_custom_add_view'] = True
                result.append(item)

        result.sort(key=operator.itemgetter('title'))
        return result
コード例 #3
0
ファイル: adding.py プロジェクト: dhavlik/Zope
    def addingInfo(self):
        """Return menu data.

        This is sorted by title.
        """
        container = self.context
        result = []
        for menu_id in (self.menu_id, 'zope.app.container.add'):
            if not menu_id:
                continue
            for item in getMenu(menu_id, self, self.request):
                extra = item.get('extra')
                if extra:
                    factory = extra.get('factory')
                    if factory:
                        factory = getUtility(IFactory, factory)
                        if not checkFactory(container, None, factory):
                            continue
                        elif item['extra']['factory'] != item['action']:
                            item['has_custom_add_view'] = True
                result.append(item)

        result.sort(key=operator.itemgetter('title'))
        return result