[Grok-dev] megrok.traject

Wichert Akkerman wichert at wiggy.net
Thu Dec 3 08:05:38 EST 2009


On 12/3/09 13:08 , Martijn Faassen wrote:
> Hi there,
>
> Christian Klinger wrote:
>> Base = declarative_base()
>> class User(Base, grok.Model):
>>      ...
>>
>>
>> This works, but i am not sure if it's the right direction?
>>
>> Is this ok to do this way?
>
> It's probably not a good idea to mix Persistent with SQLAlchemy's Base,
> as both involve meta classes. If you want to do this you're better off
> pulling in grokcore.component.Context.

You can do SQLAlchemy declarative in combination with other types that 
use a meta class. If you want an example you can take a look at 
http://code.simplon.biz/svn/projects/syslab/euphorie/buildout/devel/src/euphorie.client/euphorie/client/model.py 
. See the BaseObject class and the _instrumented logic at the end of the 
file.

Wichert.


More information about the Grok-dev mailing list