Em Domingo 23 Abril 2006 14:16, Alberto Valverde escreveu:

> I agree. At least in the jsonify case a  "jsonify_explicit" function
> is added to operate on objects the have a __json__ method, therefore
> allowing both approaches: Add a rule to jsonify or provide a __json__
> method in your objects.

This is good design. :-)  We should follow this in other parts of the code.

> Unfortunately, I cannot think of a way to offer this flexibility in
> other "generic"alized parts of TG like errorhandling.py or the new
> "expose" (which I admit not understanding yet how it actually works
> or what advantages it offers :/).

Can't we adopt the same approach for these?  How to do it is a bit beyond my 
abilities with generics right now, but I believe Simon can lend us a hand ;-)

At least we have the possibility to access each implementation separately, 
doesn't we?  So I can still write "ifs" in my code and call each one, can't 
I? :-)  This would allow "me" to write the __json__ method and do the "ifs" 
myself... :-)

> On the other hand, error_handler() doesn't need generic function
> awareness in it's simplest and most common cases, only when doing
> something fancy which in that case you can provide an optional "rule"
> parameter.

"Make simple things simple and complex things possible."

But then, this goes against the Zen of Python: "There should be one-- and 
preferably only one --obvious way to do it.". 

So, I got stuck here :-)

> Mmm, cheese... ;)

How was the race? :-)

-- 
Jorge Godoy      <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to