import web
web.internalerror=web.debugerror
urls=(
r'/(.*)', r'Index'
)
def yield_processor(handler):
try:
result = handler()
is_generator = result and hasattr(result, 'next')
except:
raise #raises
if is_generator:
return wrap(result)
else:
return result
def wrap(result):
result = iter(result)
try:
while True:
yield result.next()
except Exception, e:
yield str(e) # here we yield Exception
app=web.application(urls, globals())
app.add_processor(yield_processor)
class Index:
def GET(self, url):
yield "hello world"
function_doesnt_exists
if __name__=='__main__':
app.run()
On Dec 16, 12:11 am, je <[email protected]> wrote:
> It doesn't work here (thank you though, add_processor() is
> interesting).
--
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.