From: Andreas K. <an...@ko...> - 2005-09-10 07:30:22
|
Am Freitag, den 09.09.2005, 17:05 +0400 schrieb Oleg Broytmann: > On Fri, Sep 09, 2005 at 02:53:05PM +0200, Andreas Kostyrka wrote: > > class Worktime(SQLObject): > > customer =3D ForeignKey("customer", default=3DWHATDOIPUTHERE) > > task =3D ForeignKey("task") >=20 > > Now, a _set_customer setter doesn't work, because it needs the > > corresponding .task value >=20 > And what? Well, somehow a default value derived from another column would make much sense. Not only in this case but others too. >=20 > > and it seems that _set_customer doesn't get > > called by Worktime(...) >=20 > It must get called. What version of SQLObject? probably r915. >=20 > > Supplying a callable default value would seem to be ok, BUT the callabl= e > > doesn't get any context (like arguments to the constructor, the row > > object). >=20 > Should it? Should datetime.now (for example) gets the context? Well, datetime.now probably doesn't need the context. But other default definitions DO need access to other columns. Currently I can get the context only by inspecting the callstack and guessing ;) Andreas |