Adam Jones schrieb:
> After spending some time looking at the idea for microapps I thought it
> might be useful to wrap access to a microapp from within TurboGears
> into local and "proxied" controller methods. This allows you to run a
> local copy of a microapp in your controller and gather data through
> direct method calls or access the data remotely ... again through
> direct method calls, this time on the proxy class.
> 
> Anyways, I wrote up the basic idea here:
> http://docs.turbogears.org/1.0/TurboGearsAndMicroApps

Nice writeup! After reading this, I realized that I did a similar thing to
integrate gravatars in my blog application, i.e. I wrote a special controller,
that encapsulates access to the gravatar.com URL interface.

So you see, this is not limited to Microapps using a REST interface, as long as
the remote service exposes an URL interface and delivers results over HTTP, the
basic mechanism is the same.

I didn't separate the controller into a local and a proxy service, rather I let
the local service act as a forwarder if the requested result is not in the
local storage/cache. You can check it out in the cblog/widgets/gravatar module
of my CBlog app:

http://chrisarndt.de/projects/cblog/download/CBlog-20061130.tar.bz2

As another step to ease the usage of remote services in TurboGears websites,
this module encapsulate the display of the result in a fitting widget, i.e. an
image tag for a gravatar or, for your quote example, a nicely styled
<blockquote> element. To use the remote service in you template, you then just
have to insert a simple function call, e.g.

${gravatar.display('[EMAIL PROTECTED]', size=40)}

I also plan to write something similar for different website thumbnail
services, like Alexa, websnapr.com, artviper.net, etc.

Chris

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