-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just a quick follow up for posterity...

On Dec 1, 2006, at 10:45 AM, Barry Warsaw wrote:

> However the other thing that happens in the MailList ctor is that  
> we call a method InitTempVars() which gives each of the mixin base  
> classes a chance to set some volatile  attributes (i.e. non- 
> persistent).  On the positive side, those attributes are all non- 
> public and start with an underscore.  The problem though is that  
> when SA instantiates a MailList in response to a query, my  
> InitTempVars() methods obviously won't get called.
>
> Enter the mapper extension.
>
> So what I really want is that the regular SA magic happens and I  
> just do a little work (calling InitTempVars()) either before or  
> after that.  I'm not sure about the best way to do this.

Turns out that the populate_instance() method of the MapperExtension  
interface is the perfect hook.  I use the isnew argument to decide  
whether InitTempVars() needs to be called and get the requisite  
information from the row data.

I'm still confused about the row keys though.  They aren't exactly  
the names of the columns in my table, they are prepended with the  
table name, lowercased.  E.g. my table is named Listdata and the  
columns are host_name and list_name but the keys are  
listdata_host_name and listdata_list_name.  Is this expected?  Why is  
it this way?

Thanks,
- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iQCVAwUBRXbj53EjvBPtnXfVAQJV2QQAqScyk8KnY1m3IyciY4EGiE4904NXJ8R2
gB7m9kUEFvioCLE7QWE5VFQwrUCEEZ9vTZWAilaw1vrGbnAYjliL31XSxqNsvl01
CzjdDkyCWqClwO7snTMk+0RQ+IfScGWgHfCx5647tpuhuyNiutYtUGzJhRbhnMmM
Ab7iulSfb1M=
=tv1A
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to