hi petr...

the indentation is simply what the tab was/is set to... trivial.

i already have an sql schema.. so i don't need sqlobject to create the table... 
i'm interfacing with a live mysql/db.

while it's easy/trivial to add the 'id' via calling the class, and setting the 
'id' just like the other fields... my real goal/task was to see if you can set 
a field in the "set" method. the "set" method works for any field that i've 
tried, except the "id" issue!

the docs imply that you should be able to have the constructor be able to set a 
field within the constructor.

so.. this is the goal...

".....
It's a little more complicated if you want to override the behavior of an 
database column attribute. For instance, imagine there's special code you want 
to run whenever someone's name changes. In many systems you'd do some custom 
code, then call the superclass's code. But the superclass (SQLObject) doesn't 
know anything about the column in your subclass. It's even worse with 
properties.

SQLObject creates methods like _set_lastName for each of your columns, but 
again you can't use this, since there's no superclass to reference (and you 
can't write SQLObject._set_lastName(...), because the SQLObject class doesn't 
know about your class's columns). You want to override that _set_lastName 
method yourself.

To deal with this, SQLObject creates two methods for each getter and setter, 
for example: _set_lastName and _SO_set_lastName. So to intercept all changes to 
lastName:

"....

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Petr Jakeš
Sent: Monday, December 31, 2007 7:39 PM
To: bruce
Cc: sqlobject-discuss@lists.sourceforge.net
Subject: Re: [SQLObject] sqlobject - _init question....


1) still do not understand why you using the SQL when you can create/drop 
tables from Python using SQLobject:

MyTable.dropTable(ifExists=True)
MyTable.createTable(ifNotExists=True)

2) I can't see the purpose of your code. Can you explain why are you trying to 
set id that way? I would rather set it from the code:

foo.createTable(ifNotExists=True)
tmp=foo(id="tikdsljg",  aa='qqq', id2='ffff') 

Petr


PS: you are using some "strange" indentation in your code. Please try to follow:
http://www.python.org/doc/essays/styleguide.html and use 4 spaces indentation. 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to