Christoph Zwerschke schrieb:
> Diez B. Roggisch schrieb:
>> The test looks like this:
> > ...
>> try:
>> json['display_name'] == "Charles"
>> except KeyError:
>> assert False, "No base-class-attributes were jsonified"
>
> You forgot an "assert" in the try-block.
>
> If I set Guide = User, then everything works fine for me.
>
> Can you post your json.py rule for Guide? And did you leave the standard
> rule for User in your json.py? I assume they both apply.
No, I only have one User-related rule:
@jsonify.around("isinstance(obj, User)")
def jsonify_user(obj):
result = jso(obj)
del result['password']
# we currently assume there is just one group per user
group = obj.groups[0]
result["group"] = group.id
result["group_name"] = _(group.display_name)
result["permissions"] = [p.permission_name for p in obj.permissions]
result['type'] = {
User : "Normal",
Guide : "Guide",
}[obj.__class__]
return result
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):
AmbiguousMethod: (
[
(Signature((3, <class
'dispatch.strategy.Node'>)=TruthCriterion(True),(2, <class
'dispatch.strategy.Node'>)=TruthCriterion(False)), <function
jsonify_sqlobject at 0x18f4630>),
(Signature((0, <class
'dispatch.strategy.Node'>)=User), <function jsonify_user at
0x1d814f0>)
]
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
-~----------~----~----~----~------~----~------~--~---