Christoph Zwerschke schrieb:
> Diez B. Roggisch schrieb:
>> Instead of the "around" (that makes things work for me), when I use 
>> "when" things start to explode.
>>
>> And I think that from what I see in the error-message, there are two 
>> methods with their respective predicates (not exactly sure about the 
>> terminology, it's a bit much on the rules site to grasp so quickly):
> 
> Ok, now I see the problem.
> 
> RuleDispatch just cannot see that your rule is more specific than the 
> standard rule for SQLObjects, which is
> "is_sqlobject(obj) and not hasattr(obj, '__json__')"
> (The standard rule had been simpler in the past, that's why it had 
> worked for you before the upgrade, but it has been changed because of 
> ticket #1619 which actually had been applied by you in r3749 ;-))

Me? NEVER! Ok... I see...

> So you need to write your specific rule as:
> "is_sqlobject(obj) and not hasattr(obj, '__json__')
> and isinstance(obj, User)"
> 
> I think we need to change the default json.py template accordingly, i.e. 
> change the rules for the identity objects or use your work-"around".
> 

I wonder: how does rules detect that? Through an algebraic analysis?

> Any better ideas?

I *think* the around is good enough. However, if something speaks 
against that (I'm obviously not to experienced with Rules), we might 
consider altering is_sqlobject so that it contains the __json__-check. 
That would significantly reduce the boilerplate to write.

Or we could of course try and add a custom decorator,

@jsonify.modelobject(clazz)

that would render the proper signature.

Diez


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to