How to do this for cheetah?
def layoutify(f):
def g(*a, **kw):
return render.layout(f(*a, **kw))
return g
class Hello:
@layoutify
def GET(self):
return "foo"
Still better, in 0.3 you can write a application processor to handle
all methods.
app = web.application(urls', globals())
def layout_processor(handler):
result = handler()
return render.layout(result)
On Jan 1, 6:33 pm, "Anand Chitipothu" <[EMAIL PROTECTED]> wrote:
> > > new: support for https
>
> > What do you mean?
>
> https://bugs.launchpad.net/webpy/+bug/125295
>
> > > new: support for secure cookies
>
> > What's this?
>
> https://bugs.launchpad.net/webpy/+bug/153361
>
> > And finally, what was the reasoning from switching to return from
> > print for making output? I never heard an answer on that?
>
> switching to return from print is going to happen in 0.3, not in this release.
> With returns code becomes very modular and extendable.
>
> For example, if you want to pass output of all your GET and POST
> methods through a layout template, it is not very straight forward to
> do that with prints. But when you have returns, it is straight
> forward. Here is an example that uses a decorator.
>
> def layoutify(f):
> def g(*a, **kw):
> return render.layout(f(*a, **kw))
> return g
>
> class Hello:
> @layoutify
> def GET(self):
> return "foo"
>
> Still better, in 0.3 you can write a application processor to handle
> all methods.
>
> app = web.application(urls', globals())
>
> def layout_processor(handler):
> result = handler()
> return render.layout(result)
>
> If you have lot of code that uses prints, you don't have to worry. You
> can write an application processor to handle that too.
>
> def capture_stdout(handler):
> return web.capturestdout(handler)()
>
> app = web.application(urls, globals())
> app.add_processor(capture_stdout)
>
> I am working on module to make web.py 0.2x applications work
> seemlessly with 0.3.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---