I don't see why you can't make your mixin rule more specific:
@jsonify.when('isinstance( obj, SQLObject ) and isinstance( obj, Mixin )' )If for some reason that doesn't work, try using jsonify.around, which effectively forces it's rule to be the most specific. -ken On Jan 7, 2008 3:10 AM, Daniel Fetchinson <[EMAIL PROTECTED]> wrote: > > I have a number of classes that subclass SQLObject as well as a mixin > class and now would like to jsonify them: > > class myclass1( SQLObject, Mixin ): > ......... > ......... > > class myclass2( SQLObject, Mixin ): > .......... > .......... > > Since I have other classes that only subclass SQLObject I need to keep > the jsonify_sqlobject rule too but simply using @jsonify.when( > 'isinstance( obj, Mixin )' ) raises an AmbiguousMethod exception > because my objects match both isinstance( obj, SQLObject ) and > isinstance( obj, Mixin ). After looking into RuleDispatch this is to > be expected because neither of the two conditions is more specific > than the other so an AmbiguousMethod exception is raised. So far I > understand the story. > > When is not clear is how to work around it. How would I force > RuleDispatch to use my rule? I thought @jsonify.before( 'isinstance( > obj, Mixin )' ) would do the trick because the 'before' method would > come before the primary rule but it doesn't work, only the original > jsonify_sqlobject rule is run. > > Any ideas? > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

