Re: [SQLObject] Multiple relations between two tables
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Andy T. <an...@ha...> - 2003-08-01 13:22:56
|
Ian Bicking wrote: > This is the same bug that Javier was encountering. There's a fix in > CVS, or if SF CVS is slow (which it has been) and you want immediate > satisfaction, use this replacement function in SQLObject.py: > > def addNeedSet(obj, setCls, registry, attr): > try: > cls = findClass(setCls, registry=registry) > if callable(getattr(obj, attr, None)): > if not isinstance(getattr(obj, attr), type): > # Otherwise we got a class, which means we probably > # already set this column. > getattr(obj, attr)(cls) > else: > setattr(obj, attr, cls) > return > except KeyError: > pass > q = needSet.setdefault(registry, {}).setdefault(setCls, []) > q.append((obj, attr)) > > > > On Wed, 2003-07-30 at 07:17, Andy Todd wrote: > >>Hi, >> >>How do I define two (or more) relationships between two tables in my >>schema? I have a currencies table and a currency_rates table. Before I >>try and add the relationships their definitions are; >> [snip] >> Thanks Ian, works like a charm. And thanks for SQLObject too, its a gem. Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ |