Skip to content

Commit

Permalink
fixed quering from Klass so that only results are added to the data p…
Browse files Browse the repository at this point in the history
…roperty
  • Loading branch information
EmEhRKay committed Dec 5, 2010
1 parent 7821b11 commit cb80f7e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def query(self, query, klass=None):
result = json.loads(content)

if isinstance(klass, Klass):
klass.define_documents(result['result'])
klass.define_documents(result['result'], reset=True)
else:
return Klass(database=self, documents=result['result'])
else:
Expand Down Expand Up @@ -287,10 +287,13 @@ def __init__(self, database, name=None, schema=None, documents=None):

self.define_documents(documents)

def define_documents(self, documents=None):
def define_documents(self, documents=None, reset=False):
if documents is None:
documents = {}

if reset:
self.data = {}

keys = self.data.keys()

for data in documents:
Expand Down

0 comments on commit cb80f7e

Please sign in to comment.