Mark Ramm schrieb: > Anybody know why we have two predicate checks in the SQLAlchemy > jsonification stuff? If you want to override it for a particular > object you need to add three checks (possibly by including those two) > in order to do it, and that seems to trip people up in several places > (I've seen two projects get messed up by this, and I've heard about it > a couple times on the list.) > > I honestly don't remember why we did it that way, and am wondering if > we could do something simpler...
Do you mean hasattr(obj, 'c') and isinstance(obj.c, OrderedProperties)? This is because SQLAlchemy objects can have any class, and simply checking for the existence for a "c" attribute does not suffice. Another problem is that in SQLAlchemy 0.5 even the c attribute is gone. I solved this by checking for hasattr(obj, '_sa_class_manager') here. One idea would be to define these predicates as functions in jsonify, e.g. is_sqlalchemy_object, so you can reuse them in your code. -- Christoph --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" 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-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
