On Jan 1, 9:33 pm, "Anand Chitipothu" <[EMAIL PROTECTED]> wrote:
> 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.

Excellent, thanks for the answer.  getting away from print may help
with multithreaded applications too, no?  I thought I heard that
somewhere.

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

Reply via email to