コード例 #1
0
ファイル: controllers.py プロジェクト: esho/spire
    def __construct__(cls):
        Controller.__construct__()
        if cls.resource:
            mapping = cls.mapping
            if mapping is None:
                mapping = cls.resource.filter_schema.keys()
            cls.mapping = parse_attr_mapping(mapping)

            cls.id_field = cls.resource.id_field
コード例 #2
0
    def __construct__(cls):
        Controller.__construct__()
        if cls.resource:
            mapping = cls.mapping
            if mapping is None:
                mapping = cls.resource.filter_schema.keys()
            cls.mapping = parse_attr_mapping(mapping)

            cls.id_field = cls.resource.id_field
コード例 #3
0
ファイル: controllers.py プロジェクト: omersaeed/spire
    def __construct__(cls):
        Controller.__construct__()
        if cls.resource:
            cls.default_fields = set()
            for name, field in cls.resource.schema.iteritems():
                if field.is_identifier or not field.deferred:
                    cls.default_fields.add(name)

            mapping = cls.polymorphic_mapping
            if mapping:
                for identity, submapping in mapping.items():
                    mapping[identity] = parse_attr_mapping(submapping)
                return

            attr = cls.polymorphic_on
            if attr and not isinstance(attr, tuple):
                cls.polymorphic_on = (attr, attr)

            mapping = cls.mapping
            if mapping is None:
                mapping = cls.resource.filter_schema().keys()
            cls.mapping = parse_attr_mapping(mapping)
コード例 #4
0
    def __construct__(cls):
        Controller.__construct__()
        if cls.resource:
            cls._composite_key = cls.resource.composite_key
            cls._id_field = cls.resource.id_field.name

            cls.default_fields = set()
            for name, field in cls.resource.schema.iteritems():
                if field.is_identifier or not field.deferred:
                    cls.default_fields.add(name)

            attr = cls.polymorphic_on
            if attr and not isinstance(attr, tuple):
                cls.polymorphic_on = (attr, attr)

            mapping = cls.polymorphic_mapping
            if mapping:
                for identity, submapping in mapping.items():
                    mapping[identity] = parse_attr_mapping(submapping)
            else:
                mapping = cls.mapping
                if mapping is None:
                    mapping = cls.resource.filter_schema().keys()
                cls.mapping = parse_attr_mapping(mapping)