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

I'm making another push to convert Mailman from Python pickles to SA,  
essentially starting over from scratch (on the SA side, I'm try to  
rewrite as little of Mailman as possible).  So far so good; I've  
mostly been able to overcome the few glitches along the way.  I'm  
still in the early stages, but I think I now need to use a mapper  
extensions and I have some questions about it.

In classic Mailman, the central MailList class loads a pickled  
dictionary in its constructor and sets attributes on self  
corresponding to the keys/values found there.  This part is fairly  
easy to just rip out and let SA do its magic.

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.  The first thing I noticed is that the  
documentation for MapperExtension.create_instance() is incorrect.  It  
only describes 4 arguments (plus self), but in SA 0.3.x, that method  
takes 5 arguments.  I found the proper signature in an example in the  
FAQ, but the question is what is the 'imap' argument?

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.  Will SA populate  
the object I return from create_instance() with the row data or do I  
have to do that myself?

The other thing is that InitTempVars() requires one argument, which  
can be calculated from data in the row.  That's fine because the row  
is passed to create_instance(), but it looks weird.  If I dump out  
the keys of the row object, they look like column names with the  
lower cased table name prepended.  E.g. the columns I need are  
list_name and host_name but the corresponding keys in the row object  
are listdata_list_name and listdata_host_name ('Listdata' being the  
name of my table).  I'm not sure if this is the intention or if  
there's a better way to get the row data out in create_instance().

Thanks in advance,
- -Barry

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

iQCVAwUBRXBOLXEjvBPtnXfVAQJZmgQAtcwVzm8lf87ou5GMxnIDWh4NVLqLAKh7
ZTn+YiKoYHEaKXTzrr3eKiGlSuC2t4xSQJueXW/dL3JMeZEcSBEf4Uw6gMDvQEgs
aoVHqw53JA3qe2o+Z5QYMDbH0adxRL4mE3Cvd4es0TZRhsK1f3eMNZJwR8Tvt05O
lX2nBktPG0w=
=NqCY
-----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