[EMAIL PROTECTED] ha scritto:
> Hi everyone,
>
> I've done some more work on my alternative to turbogears.flash(), and
> it's pretty decent as this point (at least I think so), and it might
> be useful for others.
>   

Thank you, it's just like what I needed, the way I would have done it :-)

I suggest you to bind a Flash() instance to the current request, and 
wrap inner methods:


> def get_flash_service():
>     try:
>         ret = cherrypy.request.flash_service
>     except AttributeError:
>         ret = cherrypy.request.flash_service = Flash()
>     return ret
>
>
> def info(*args, **kw):
>     get_flash_service().info(*args, **kw)
>
> def warning(*args, **kw):
>     get_flash_service().warning(*args, **kw)
>
> def error(*args, **kw):
>     get_flash_service().error(*args, **kw)
>
> def ok(*args, **kw):
>     get_flash_service().ok(*args, **kw)
>
> def add_message(*args, **kw):
>     get_flash_service().add_message(*args, **kw)


This way, you can just use

import flash

flash.warning('whatever')




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