Skip to content

Commit

Permalink
Added reload to ElasticSearchModel
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Paro committed Feb 15, 2012
1 parent 36bf782 commit a673fbf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pyes/es.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a673fbf

Please sign in to comment.