Completed JSON importer. Exported from import matches original data, must be working
This commit is contained in:
parent
7f9e5dbf65
commit
03ce460181
3 changed files with 55 additions and 2 deletions
|
@ -62,6 +62,21 @@ class Field(object):
|
|||
'dataLength': len(data)
|
||||
}
|
||||
|
||||
def fromJSON(self, o):
|
||||
import re
|
||||
|
||||
self.__init__(
|
||||
name=o['name'],
|
||||
max_length=o['maxLength'],
|
||||
required=o['required'],
|
||||
)
|
||||
|
||||
if isinstance(o['value'], basestring) and re.match('^\d*\.\d*$', o['value']):
|
||||
o['value'] = decimal.Decimal(o['value'])
|
||||
|
||||
self.value = o['value']
|
||||
return self
|
||||
|
||||
|
||||
class TextField(Field):
|
||||
def validate(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue