Skip to content

Commit

Permalink
Various fixes and functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
evertheylen committed Aug 31, 2016
1 parent b6aade3 commit 0282e06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions sparrow/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ class _Json(StaticType):
def to_sql(obj):
return json.dumps(obj)

@staticmethod
def from_sql(obj):
return json.loads(obj)
#@staticmethod
#def from_sql(obj):
#return json.loads(obj)

Json = _Json(str)
Json = _Json(str, "JSONB")

class List(Type):
def __init__(self, inner_type):
Expand Down Expand Up @@ -741,7 +741,7 @@ async def update(self, db=None):
assert self.in_db
dct = {}
for p in self._complete_props:
dct[p.name] = self.__dict__[p.dataname]
dct[p.name] = p.type.to_sql(self.__dict__[p.dataname])
if type(self)._incomplete:
dct[type(self).key.name] = self.__dict__[type(self).key.dataname]
await type(self)._update_command.with_data(**dct).exec(db)
Expand Down
2 changes: 1 addition & 1 deletion sparrow/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def json_info(self):
print(indent(json.dumps(d, indent=4)))
else:
print("Definition is custom!")
if hasattr(c.json_repr, "__doc__"):
if hasattr(c.json_repr, "__doc__") and c.json_repr.__doc__ is not None:
print("The documentation says:\n\n" + indent(c.json_repr.__doc__, code=False))
possible_for = True

Expand Down

0 comments on commit 0282e06

Please sign in to comment.