Commit 2fde6572 by Dave Gadling

ParseResource's need to know they've been loaded

In __getattr__ we check to see if the object has been lazy loaded or not
before we try to do attribute lookups. However, once the attributes have
been loaded, we never record that.

So this changes _init_attrs, which actually does the loading, to record
that it's done so.

This change took a loop I had that was taking 8-10s to finish down to
.5-1s.
parent a48cadb1
...@@ -237,6 +237,7 @@ class ParseResource(ParseBase): ...@@ -237,6 +237,7 @@ class ParseResource(ParseBase):
def _init_attrs(self, args): def _init_attrs(self, args):
for key, value in six.iteritems(args): for key, value in six.iteritems(args):
setattr(self, key, ParseType.convert_from_parse(value)) setattr(self, key, ParseType.convert_from_parse(value))
self._is_loaded = True
def _to_native(self): def _to_native(self):
return ParseType.convert_to_parse(self) return ParseType.convert_to_parse(self)
......
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