예제 #1
0
    def get_types_by_method(plural,
                            method,
                            expendNestedTypes=False,
                            groupOptions=False):
        """INTERNAL: return a list of types that implement given method and context/s of this types."""
        sing_types = {}

        if method:
            for decorator in TypeHelper.getKnownDecoratorsTypes():
                dct = getattr(brokers, decorator).__dict__
                if dct.has_key(method):
                    if decorator.endswith('s'):
                        cls_name = TypeHelper.getDecoratorType(
                            TypeHelper.to_singular(decorator))
                        if cls_name:
                            MethodHelper.get_method_params(
                                brokers, cls_name, '__init__', sing_types,
                                expendNestedTypes, groupOptions)

            if plural:
                sing_types_plural = {}
                for k in sing_types.keys():
                    sing_types_plural[TypeHelper.to_plural(k)] = sing_types[k]
                return sing_types_plural
            return sing_types
예제 #2
0
    def get_types_containing_method(method, expendNestedTypes=False, groupOptions=False):
        """return a list of types by method including context in which this method available."""
        types = {}

        for decorator in TypeHelper.getKnownDecoratorsTypes():
                if not decorator.endswith('s'):
                    dct = getattr(brokers, decorator).__dict__
                    if dct and len(dct) > 0 and dct.has_key(method):
                        MethodHelper.get_method_params(brokers, decorator, '__init__', types,
                                                       expendNestedTypes=expendNestedTypes,
                                                       groupOptions=groupOptions)
        return types
예제 #3
0
    def get_actionable_types(expendNestedTypes=False, groupOptions=False):
        """INTERNAL: return a list of actionable types."""
        types = {}
        exceptions = ['delete', 'update']

        for decorator in TypeHelper.getKnownDecoratorsTypes():
                if not decorator.endswith('s'):
                    dct = getattr(brokers, decorator).__dict__
                    if dct and len(dct) > 0:
                        for method in dct:
                            if method not in exceptions and not method.startswith('_'):
                                MethodHelper.get_method_params(brokers, decorator, '__init__', types,
                                                               expendNestedTypes=expendNestedTypes,
                                                               groupOptions=groupOptions)
                                break
        return types
예제 #4
0
    def get_types_containing_method(method,
                                    expendNestedTypes=False,
                                    groupOptions=False):
        """return a list of types by method including context in which this method available."""
        types = {}

        for decorator in TypeHelper.getKnownDecoratorsTypes():
            if not decorator.endswith('s'):
                dct = getattr(brokers, decorator).__dict__
                if dct and len(dct) > 0 and dct.has_key(method):
                    MethodHelper.get_method_params(
                        brokers,
                        decorator,
                        '__init__',
                        types,
                        expendNestedTypes=expendNestedTypes,
                        groupOptions=groupOptions)
        return types
예제 #5
0
    def get_actionable_types(expendNestedTypes=False, groupOptions=False):
        """INTERNAL: return a list of actionable types."""
        types = {}
        exceptions = ['delete', 'update']

        for decorator in TypeHelper.getKnownDecoratorsTypes():
            if not decorator.endswith('s'):
                dct = getattr(brokers, decorator).__dict__
                if dct and len(dct) > 0:
                    for method in dct:
                        if method not in exceptions and not method.startswith(
                                '_'):
                            MethodHelper.get_method_params(
                                brokers,
                                decorator,
                                '__init__',
                                types,
                                expendNestedTypes=expendNestedTypes,
                                groupOptions=groupOptions)
                            break
        return types
예제 #6
0
    def get_types_by_method(plural, method, expendNestedTypes=False, groupOptions=False):
        """INTERNAL: return a list of types that implement given method and context/s of this types."""
        sing_types = {}

        if method:
            for decorator in TypeHelper.getKnownDecoratorsTypes():
                dct = getattr(brokers, decorator).__dict__
                if dct.has_key(method):
                    if decorator.endswith('s'):
                        cls_name = TypeHelper.getDecoratorType(TypeHelper.to_singular(decorator))
                        if cls_name:
                            MethodHelper.get_method_params(brokers,
                                                           cls_name,
                                                           '__init__',
                                                           sing_types,
                                                           expendNestedTypes,
                                                           groupOptions)

            if plural:
                sing_types_plural = {}
                for k in sing_types.keys():
                    sing_types_plural[TypeHelper.to_plural(k)] = sing_types[k]
                return sing_types_plural
            return sing_types