Example #1
0
 def subTypes(self):
     util = queryUtility(IResourceFactoryUtility,
                         name=self.utility,
                         default=None)
     if IResourceSubTypes.providedBy(util):
         subtypes = util
     else:
         subtypes = queryAdapter(util, IResourceSubTypes, default=None)
     if subtypes is not None:
         return subtypes.types()
     return []
Example #2
0
 def subTypes(self):
     util = queryUtility(IResourceFactoryUtility,
                         name=self.utility,
                         default=None)
     if IResourceSubTypes.providedBy(util):
         subtypes = util
     else:
         subtypes = queryAdapter(util, IResourceSubTypes, default=None)
     if subtypes is not None:
         return subtypes.types()
     return []
Example #3
0
    def types(self):
        utilities = sorted(getUtilitiesFor(IResourceFactoryUtility))
        types = []
        for name, utility in utilities:
            if IResourceSubTypes.providedBy(utility):
                subTypeAdapter = utility
            else:
                subTypeAdapter = queryAdapter(utility, IResourceSubTypes,
                                          default=None)
                if subTypeAdapter != None:
                    subTypeAdapter = subTypeAdapter()

            typeHeader = {'id':name,
                          'title':utility.title,
                          'clickable':False}
            types.append(typeHeader)
            for subtype in subTypeAdapter.types():
                types.append({'id':name, 'title':subtype, 'clickable':True})
        return types
Example #4
0
    def getSubTypes(self):
        utilities = sorted(getUtilitiesFor(IResourceFactoryUtility))

        types = []
        for name, utility in utilities:
            if IResourceSubTypes.providedBy(utility):
                subTypeAdapter = utility
            else:
                subTypeAdapter = queryAdapter(utility, IResourceSubTypes,
                                          default=None)
                if subTypeAdapter != None:
                    subTypeAdapter = subTypeAdapter()

            typeHeader = [name, utility.title, 'unclickable']
            subTypes = subTypeAdapter.types()
            if subTypes:
                types.append(typeHeader)
                for subtype in subTypes:
                    types.append([name, subtype, 'clickable'])
        return types
Example #5
0
    def getSubTypes(self):
        utilities = sorted(getUtilitiesFor(IResourceFactoryUtility))

        types = []
        for name, utility in utilities:
            if IResourceSubTypes.providedBy(utility):
                subTypeAdapter = utility
            else:
                subTypeAdapter = queryAdapter(utility,
                                              IResourceSubTypes,
                                              default=None)
                if subTypeAdapter != None:
                    subTypeAdapter = subTypeAdapter()

            typeHeader = [name, utility.title, 'unclickable']
            subTypes = subTypeAdapter.types()
            if subTypes:
                types.append(typeHeader)
                for subtype in subTypes:
                    types.append([name, subtype, 'clickable'])
        return types
Example #6
0
    def types(self):
        utilities = sorted(getUtilitiesFor(IResourceFactoryUtility))
        types = []
        for name, utility in utilities:
            if IResourceSubTypes.providedBy(utility):
                subTypeAdapter = utility
            else:
                subTypeAdapter = queryAdapter(utility,
                                              IResourceSubTypes,
                                              default=None)
                if subTypeAdapter != None:
                    subTypeAdapter = subTypeAdapter()

            typeHeader = {
                'id': name,
                'title': utility.title,
                'clickable': False
            }
            types.append(typeHeader)
            for subtype in subTypeAdapter.types():
                types.append({'id': name, 'title': subtype, 'clickable': True})
        return types