On Wed, Jun 10, 2009 at 06:06:16PM -0700, Sam's Lists wrote:
> class sqlmeta:
>         style = MixedCaseStyle(longID=True)
> 
> It appears that under the really old versions of TurboGears one could
> refer to this EventQueueID as just .id and everything would work the
> way you want it to.  (This appears to only be done in the app under
> kid templates).
> 
> But now, under TG 1.0.8/the latest version of SQLObject that doesn't work.
>  Either I have to rename the
> column to id or I have to refer to it as EventQueueID.

   Well, you can always give the name of the column:

class MyTable(SQLObject):
   class sqlmeta:
      style = MixedCaseStyle(longID=True)
      idName = 'id' # or 'MyTableID' or whatever.

> How can I make sqlObject seemlessly let me refer to columns named in
> the long style just using id?

class Test(SQLObject):
    class sqlmeta:
        style = MixedCaseStyle(longID=True)

Test.createTable()

test = Test()
print test.id

   Output (SQLObject 0.10):

  1/Query   :  CREATE TABLE Test (
    id INTEGER PRIMARY KEY
)
 1/QueryR  :  CREATE TABLE Test (
    id INTEGER PRIMARY KEY
)
 1/Query   :  CREATE TABLE Test (
    id INTEGER PRIMARY KEY
)
 1/QueryR  :  CREATE TABLE Test (
    id INTEGER PRIMARY KEY
)
 2/QueryIns:  INSERT INTO Test VALUES (NULL)
 2/QueryR  :  INSERT INTO Test VALUES (NULL)
 3/QueryOne:  SELECT NULL FROM Test WHERE ((Test.id) = (1))
 3/QueryR  :  SELECT NULL FROM Test WHERE ((Test.id) = (1))
 1/Query   :  CREATE TABLE Test (
    id INTEGER PRIMARY KEY
)
 1/QueryR  :  CREATE TABLE Test (
    id INTEGER PRIMARY KEY
)
 2/QueryIns:  INSERT INTO Test VALUES (NULL)
 2/QueryR  :  INSERT INTO Test VALUES (NULL)
 3/QueryOne:  SELECT NULL FROM Test WHERE ((Test.id) = (1))
 3/QueryR  :  SELECT NULL FROM Test WHERE ((Test.id) = (1))

   No problem so far - id is id, not TestId. What am I doing wrong?

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            p...@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to