On Mon, Jun 11, 2007 at 04:24:11PM -0400, Stanko Petrovic wrote:
> class Testadd(so.SQLObject):
>    class sqlmeta:
>        style = so.MixedCaseStyle(longID=True)
>        table = 'testadd'
> 
>    Name = so.StringCol()
>    BufferSize = so.FloatCol( default = 0.0 )
> 
>    def _set_BufferSize(self, value):
>        if value != self._SO_get_BufferSize():
>            value = 1.0
>        self._SO_set_BufferSize(value)
> 
>    def _get_BufferSize(self):
>        return self._SO_get_BufferSize()
> 
> t2=Testadd(Name="test6")

   You are creating a new row; the row hasn't been instered yet, so it
doesn't have an id. But before setting the new value in _set_BufferSize()
you ask the database about the previous value. How can SQLObject answer the
question without knowing the id of the row? It cannot, hence the error:

> This fails with error main.py line 1124 in set
> raise AttributeError ......
> Testadd object has no attribute 'id' (with attribute 'BufferSize')

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to