コード例 #1
0
ファイル: validators.py プロジェクト: sbermeister/JsonWeb
    def __get__(self, obj, type=None):

        if type is None:
            return self
        if not isinstance(self.__type, basestring):
            return self
        #``_type`` was a string and now we must get the actual class
        handler = _default_object_handlers.get(self.__type)

        if not handler:
            raise JsonWebError("Cannot find class %s." % self.__type)
        return EnsureType(handler[1])
コード例 #2
0
    def __get__(self, obj, type=None):

        if type is None:
            return self
        if not isinstance(self.__type, str):
            return self

        from jsonweb.decode import _default_object_handlers
        #``_type`` was a string and now we must get the actual class
        handler = _default_object_handlers.get(self.__type)

        if not handler:
            raise JsonWebError("Cannot find class {0}.".format(self.__type))

        return EnsureType(handler[1],
                          type_name=self.__type_name,
                          optional=(not self.required),
                          nullable=self.nullable)
コード例 #3
0
ファイル: validators.py プロジェクト: androm3da/JsonWeb
    def __get__(self, obj, type=None):

        if type is None:
            return self
        if not isinstance(self.__type, str):
            return self

        from jsonweb.decode import _default_object_handlers
        #``_type`` was a string and now we must get the actual class
        handler = _default_object_handlers.get(self.__type)

        if not handler:
            raise JsonWebError("Cannot find class {0}.".format(self.__type))

        return EnsureType(
            handler[1],
            type_name=self.__type_name,
            optional=(not self.required),
            nullable=self.nullable
        )