~bozo-dragojevic-joost/storm/proxiable-references

« back to all changes in this revision

Viewing changes to storm/references.py

  • Committer: Bozo Dragojevic
  • Date: 2009-07-07 23:07:16 UTC
  • Revision ID: bozzo@ceckalica-20090707230716-58y42r18dg680s05
 teach storm to walk mapped Reference() for building up complex queries. probably needs sprinkling of a few ClassAlias() somewhere inthere if users become really greedy

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
            self._build_relation()
112
112
        return self._relation.get_where_for_local(other)
113
113
 
 
114
    def __getattr__(self, name):
 
115
        if self._relation is None:
 
116
            self._build_relation()
 
117
        p = Proxy(self, getattr(self._remote_key[0].table, name))
 
118
        return p
114
119
 
115
120
class ReferenceSet(object):
116
121
 
322
327
    def variable_factory(self):
323
328
        return self._remote_prop.variable_factory
324
329
 
 
330
    def __getattr__(self, name):
 
331
        return self._remote_prop.__getattr__(name)
 
332
 
325
333
@compile.when(Proxy)
326
334
def compile_proxy(compile, proxy, state):
327
335
    # References build the relation lazily so that they don't immediately