def getDecodableAttributes(self, obj, attrs, codec=None):
        attrs = super(NDBClassAlias, self).getDecodableAttributes(obj,
                                                                  attrs,
                                                                  codec=codec)

        if self.repeated_properties:
            for name, prop in self.repeated_properties.iteritems():
                try:
                    value = attrs[name]
                except KeyError:
                    continue

                if not value:
                    attrs[name] = []

                    continue

                for idx, val in enumerate(value):
                    value[idx] = adapter_models.decode_model_property(
                        obj, prop, val)

                attrs[name] = value

        if self.non_repeated_properties:
            adapter_models.decode_model_properties(
                obj,
                self.non_repeated_properties,
                attrs,
            )

        return attrs
    def getDecodableAttributes(self, obj, attrs, codec=None):
        attrs = super(NDBClassAlias, self).getDecodableAttributes(
            obj, attrs, codec=codec
        )

        if self.repeated_properties:
            for name, prop in self.repeated_properties.iteritems():
                try:
                    value = attrs[name]
                except KeyError:
                    continue

                if not value:
                    attrs[name] = []

                    continue

                for idx, val in enumerate(value):
                    value[idx] = adapter_models.decode_model_property(
                        obj,
                        prop,
                        val
                    )

                attrs[name] = value

        if self.non_repeated_properties:
            adapter_models.decode_model_properties(
                obj,
                self.non_repeated_properties,
                attrs,
            )

        return attrs
예제 #3
0
    def getDecodableAttributes(self, obj, attrs, codec=None):
        attrs = super(DataStoreClassAlias,
                      self).getDecodableAttributes(obj, attrs, codec=codec)

        if self.properties:
            adapter_models.decode_model_properties(obj, self.properties, attrs)

        return attrs
    def getDecodableAttributes(self, obj, attrs, codec=None):
        attrs = super(DataStoreClassAlias, self).getDecodableAttributes(
            obj,
            attrs,
            codec=codec
        )

        if self.properties:
            adapter_models.decode_model_properties(obj, self.properties, attrs)

        return attrs