Re: [SQLObject] alternateID selections
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ian B. <ia...@co...> - 2003-06-06 18:56:11
|
On Fri, 2003-06-06 at 11:51, Edmund Lian wrote: > I notice that when alternateID=True, and the associated .byWhatever() > selection is performed, a SQLObjectNotFound exception is raised rather > than None or [] being returned. However, when a normal .select() method > is used, [] is returned. > > Does this seem a bit inconsistent? I'm thinking that with a .select(), > one expects a list, so an empty list for no result makes sense. > Similarly, with a .byWhatever(), one expects an object, so perhaps None > for no result makes more sense than an exception? No, I think SQLObjectNotFound is right. .byWhatever() is analogous to normal class instantiation, not selection. NULL references do get resolved to None, but those are explicit references in the database -- the analog of a join with a NULL reference (which doesn't throw an exception) would be a call like SomeObject.byWhatever(None), which isn't sensical. Ian |