From: Luke H. <lh...@eb...> - 2003-01-08 04:12:44
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > It's kind of lame, but SecureMixIn could have a method: > > def awake(self, trans): > SiteLayout.awake(self, trans) Yuck =) That goes against the idea of mixins... if I where to use this mixin with say... SubSiteLayout ... ah well you get the idea =) > I can't think of a good way to have PSP do this. Unless perhaps it used > the new-and-fancy super() call (which I don't completely understand > yet). Or PSP could add something to __init__, like: Is there a way to test if a method exists within a class? If so... the code PSP creates could recurse through the parent classes looking for the first class that implements the awake method. so you might end up with something like this in your generated class: def awake(self.trans): for baseclass in self.__class__.__bases__ if ... (code to check if the method exists?): baseclass.awake(self, trans) break self.initPSP() This should should hopefully make calling the awake method simular to how Python looks up methods in parent classes.... So the first class to implement the method is the one which gets used for that method. - -- Luke Holden eBI Solutions Main: (949) 387-5182 Email: lh...@eb... -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+G6U+3q5xXfLZTQkRApqQAKDGfaoORXOKDsz4TQ0BTxW9uwivtwCeLD06 EEuiIbtre/Zp8k3w3ggT3J4= =TIik -----END PGP SIGNATURE----- |