Permalink
Browse files

Added reload to ElasticSearchModel

  • Loading branch information...
Alberto Paro
Alberto Paro committed Feb 15, 2012
1 parent 36bf782 commit a673fbff18e2a27a71735d1337a4bc0d98d152d0
Showing with 7 additions and 3 deletions.
  1. +7 −3 pyes/es.py
View
@@ -80,9 +80,6 @@ def __setattr__(self, key, value):
else:
self.__setitem__(key, value)
- def __repr__(self):
- return repr(self)
-
def get_meta(self):
return self._meta
@@ -113,6 +110,13 @@ def save(self, bulk=False, id=None, parent=None, force=False):
return res._id
return id
+ def reload(self):
+ meta = self._meta
+ conn = meta['connection']
+ res = conn.get(meta.index, meta.type, meta["id"])
+ self.update(res)
+
+
def get_id(self):
""" Force the object saveing to get an id"""
_id = self._meta.get("id", None)

0 comments on commit a673fbf

Please sign in to comment.