Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

DictObj: accept non-unicode return type for String.

  • Loading branch information...
commit 23f2462398be9235b390c3cd8a2bd4d7340a59b6 1 parent 69adf75
@plq authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 spyne/protocol/_dictobj.py
View
8 spyne/protocol/_dictobj.py
@@ -29,6 +29,7 @@
from spyne.model.complex import Array
from spyne.model.primitive import DateTime
from spyne.model.primitive import Decimal
+from spyne.model.primitive import String
from spyne.model.primitive import Unicode
from spyne.protocol import ProtocolBase
@@ -228,12 +229,13 @@ def _from_dict_value(self, cls, value):
# validate raw input
if self.validator is self.SOFT_VALIDATION:
if issubclass(cls, Unicode) and not isinstance(value, unicode):
- raise ValidationError(value)
+ if not (issubclass(cls, String) and isinstance(value, str)):
+ raise ValidationError(value)
- if issubclass(cls, Decimal) and not isinstance(value, (int, long, float)):
+ elif issubclass(cls, Decimal) and not isinstance(value, (int, long, float)):
raise ValidationError(value)
- if issubclass(cls, DateTime) and not (isinstance(value, unicode) and
+ elif issubclass(cls, DateTime) and not (isinstance(value, unicode) and
cls.validate_string(cls, value)):
raise ValidationError(value)
Please sign in to comment.
Something went wrong with that request. Please try again.