Commit 1098b32a by Raphael Lullis

getting _editable_attrs to return a dict. That will make things easier to get…

getting _editable_attrs to return a dict. That will make things easier to get only 'public' attributes from objects'
parent 1e16cff6
...@@ -44,7 +44,7 @@ class ParseType(object): ...@@ -44,7 +44,7 @@ class ParseType(object):
if is_object and not as_pointer: if is_object and not as_pointer:
return dict([(k, ParseType.convert_to_parse(v, as_pointer=True)) return dict([(k, ParseType.convert_to_parse(v, as_pointer=True))
for k, v in python_object._editable_attrs for k, v in python_object._editable_attrs.items()
]) ])
python_type = Object if is_object else type(python_object) python_type = Object if is_object else type(python_object)
...@@ -188,7 +188,7 @@ class ParseResource(ParseBase, Pointer): ...@@ -188,7 +188,7 @@ class ParseResource(ParseBase, Pointer):
def _editable_attrs(self): def _editable_attrs(self):
protected_attrs = self.__class__.PROTECTED_ATTRIBUTES protected_attrs = self.__class__.PROTECTED_ATTRIBUTES
allowed = lambda a: a not in protected_attrs and not a.startswith('_') allowed = lambda a: a not in protected_attrs and not a.startswith('_')
return [(k, v) for k, v in self.__dict__.items() if allowed(k)] return dict([(k, v) for k, v in self.__dict__.items() if allowed(k)])
def __init__(self, **kw): def __init__(self, **kw):
for key, value in kw.items(): for key, value in kw.items():
......
...@@ -90,7 +90,7 @@ class User(ParseResource): ...@@ -90,7 +90,7 @@ class User(ParseResource):
def _to_native(self): def _to_native(self):
return dict([(k, ParseType.convert_to_parse(v, as_pointer=True)) return dict([(k, ParseType.convert_to_parse(v, as_pointer=True))
for k, v in self._editable_attrs]) for k, v in self._editable_attrs.items()])
def __repr__(self): def __repr__(self):
return '<User:%s (Id %s)>' % (self.username, self.objectId) return '<User:%s (Id %s)>' % (self.username, self.objectId)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment