Re: [SQLObject] Adding attributes to columns fetched by fromDatabase?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ma...> - 2006-07-25 16:29:35
|
On Thu, Jul 20, 2006 at 01:30:59PM -0700, Derek wrote: > Another somewhat silly question, anyone know of a way I can add > attributes to columns that were autogenerated by using fromDatabase=True ? > > class News(SQLObject): > _connection = conn > _connection.debug = True > class sqlmeta: > fromDatabase = True > idName = 'NID' > style = FOMStyle() > > body.prettyName = 'Post Body' > subject.prettyName = 'Subject' > > body.prettyName and subject.prettyName both generate an error (because > body isn't actually defined anywhere). You have to wait until SQLObject metaclass creates the class and fetches the columns: class News(SQLObject): _connection = conn _connection.debug = True class sqlmeta: fromDatabase = True idName = 'NID' style = FOMStyle() News.body.prettyName = 'Post Body' News.subject.prettyName = 'Subject' Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |