Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Commit

Permalink
small refactorization
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Frasca committed Jan 1, 2015
1 parent 0c9717f commit e9b202c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bauble/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ def evaluate(self, env):
query = env.session.query(env.domain)
if len(self.value) == 1:
# identifier is an attribute of the table being queried
attr = getattr(env.domain, self.value[0])
cls = env.domain
elif len(self.value) > 1:
# identifier is an attribute of a joined table
query = query.join(*self.value[:-1], aliased=True)
attr = getattr(query._joinpoint['_joinpoint_entity'], self.value[-1])
cls = query._joinpoint['_joinpoint_entity']
attr = getattr(cls, self.value[-1])
return query, attr

def needs_join(self, env):
Expand Down

0 comments on commit e9b202c

Please sign in to comment.