j2labs/dictshield — Issue #39: JSON field called "self" throws DictShield error
Author: alexanderdean
Created: 2011-11-30 18:44:50+00:00
State: open

Test code:

#!/usr/bin/env python

from dictshield.document import Document
from dictshield.fields import StringField

data = {
"code" : "GBP",
"self" : "http://localhost:8080/currencies/GBP" # Replacing with "link": works fine
}

class Currency(Document):
code = StringField(required=True)

curr = Currency(**data)
try:
curr.validate()
except ShieldException, se:
print 'ShieldException caught: %s' % se

print "This currency's code is %s" % curr.code

Error:

Traceback (most recent call last):
File "./scratchpad.py", line 14, in
curr = Currency(**data)
TypeError: __init__() got multiple values for keyword argument 'self'