On 10/19/06, John Henry <[EMAIL PROTECTED]> wrote:
> So expose is an imported function from TurboGear?  So, this is just a
> way to setup a call back function?

Expose is an imported decorator from turbogears -- specifically,
turbogears.controllers.expose().

It's not really a callback*, it's a wrapper around the underlying
function. Basically, CherryPy wants a particular method** to have an
``exposed`` attribute set to True in order to ensure only the desired
parts of your API are exposed to the web. The original expose()
decorator in CherryPy simply set this attribute and called the wrapped
function. The TurboGears version adds a number of bells and whistles
like template handling, but otherwise it basically does the same thing

* I think of a callback as something you register to be called when a
certain event happens so you can respond to an event. You could argue
the same thing is happening here, but I differentiate because the
motivation in callbacks vs wrapping is different.

** Remember that functions/methods in python are objects, so they can
have their own attributes, methods, etc. Similarly, objects can be
made to be function-like, or callable, by defining __call__() in the
class.

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

Reply via email to