Пример #1
0
    def _unserialize_value(self, value):
        if not isinstance(value, basestring):
            raise InvalidTypeError(value=value).construct(self, 'invalid')

        try:
            return import_object(value)
        except ImportError:
            raise ValidationError(value=value).construct(self, 'import')
Пример #2
0
 def _unserialize_value(self, value, ancestry):
     if isinstance(value, basestring):
         try:
             return import_object(value)
         except ImportError:
             error = ValidationError(identity=ancestry, field=self, value=value).construct("import", value=value)
             raise error.capture()
     else:
         return value
Пример #3
0
 def _unserialize_value(self, value, ancestry):
     if isinstance(value, basestring):
         try:
             return import_object(value)
         except ImportError:
             error = ValidationError(identity=ancestry, field=self, value=value).construct(
                 'import', value=value)
             raise error.capture()
     else:
         return value
Пример #4
0
    def _get_implementation(cls, token):
        if token is None:
            return surrogate
        elif token in cls.cache:
            return cls.cache[token]

        try:
            impl = import_object(token)
        except ImportError:
            impl = surrogate

        cls.cache[token] = impl
        return impl
Пример #5
0
    def _get_implementation(cls, token):
        if token is None:
            return surrogate
        elif token in cls.cache:
            return cls.cache[token]

        try:
            impl = import_object(token)
        except ImportError:
            impl = surrogate

        cls.cache[token] = impl
        return impl