Hey,

Michael Bayer wrote:
> subclass RelationProperty fine, but don't get involved with overriding its
> internal _xxx methods.

So:

Override do_init() completely (not calling the super do_init()).

Do something like:

     def do_init(self):
         self._get_target()
         self._process_dependent_arguments()
         self.custom_joins()
         self._determine_joins()
         self._determine_synchronize_pairs()
         self._determine_direction()
         self._determine_local_remote_pairs()
         self._post_init()
         super(RelationProperty, self).do_init()

Then introduce a custom_joins() that will now have access to a properly 
set up local_table and mapper_table and self.parent and self.target etc, 
and implement something very close to _determine_joins except inserting 
custom arguments.

Problem: the backref will already have been set up, and this will not 
get the custom arguments.

So, I need to override __init__, copying it completely and setting up 
the backref there if needed, or hackishly override the previously set up 
backref in custom_joins.

It's pretty involved, ugly, and fragile. It'd be nicer if there was a 
way to do this generically, as I just want to add a custom condition to 
the automatically set up primary...

Regards,

Martijn


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to