Re: [Repoze-dev] flashing messages with bfg

2009-07-11 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Alberto Valverde wrote:
 Iain Duncan wrote:
 Hey folks, wondering what the conventional way of flashing a message
 after a model update when using HTTPFound for redirects. Is this
 something that people roll-their-own for, or is there a standard to
 follow? I'd like to make sure my crud app is as bfg'ish as possible so
 it can be useful to others.
   
 You can also use the lib I wrote for TG2 and rum with repoze.bfg (as I'm
 doing myself). It only needs a webob-like response and/or request 
 objects so it can be used nicely inside a bfg view.
 
 http://pypi.python.org/pypi/WebFlash/0.1a9

Looks cool!


Tres.
- --
===
Tres Seaver  +1 540-429-0999  tsea...@palladion.com
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKWObr+gerLs4ltQ4RAolFAKCYuUQDeDoPKGvSkKemE8Cbv+vQaACg0kMR
565+dwXGhVelqyxNaIMBOrg=
=xN+z
-END PGP SIGNATURE-
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] flashing messages with bfg

2009-07-08 Thread Iain Duncan
Hey folks, wondering what the conventional way of flashing a message
after a model update when using HTTPFound for redirects. Is this
something that people roll-their-own for, or is there a standard to
follow? I'd like to make sure my crud app is as bfg'ish as possible so
it can be useful to others.

Thanks
Iain

___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] flashing messages with bfg

2009-07-08 Thread Iain Duncan
On Wed, 2009-07-08 at 02:36 -0400, Chris McDonough wrote:
 We don't have a convention for flash.  I've been remiss in seeing how the 
 other frameworks implement this, but I *think* something like this would be 
 closest:
 
 return render_template_to_response('some/template.pt', message='Updated')
 
 And in the template:
 
 div class=someclass${message}/div

Thanks Chris. The convention in the other frameworks that I've used is
that the message is 'flashed' when handling the update from a post, and
displayed after the redirect, to avoid the problem when a user hits
resend after a post that should not occur twice. So usually the flash
helper is a simple utility to set, read, and wipe a session variable or
cookie. I guess bfg is not making any assumptions about session vars or
cookies though?

If you are thinking of adding such a thing to bfg, I'll hold off on my
own ( or use a really crappy one ). Can we set a simple cookie with
webob maybe as an ultralight version that doesn't depend on a particular
method of storing session vars?  

thanks
iain


___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] flashing messages with bfg

2009-07-08 Thread Chris McDonough
On 7/8/09 2:54 AM, Iain Duncan wrote:
 On Wed, 2009-07-08 at 02:36 -0400, Chris McDonough wrote:
 We don't have a convention for flash.  I've been remiss in seeing how the
 other frameworks implement this, but I *think* something like this would be 
 closest:

 return render_template_to_response('some/template.pt', message='Updated')

 And in the template:

 div class=someclass${message}/div

 Thanks Chris. The convention in the other frameworks that I've used is
 that the message is 'flashed' when handling the update from a post, and
 displayed after the redirect, to avoid the problem when a user hits
 resend after a post that should not occur twice. So usually the flash
 helper is a simple utility to set, read, and wipe a session variable or
 cookie. I guess bfg is not making any assumptions about session vars or
 cookies though?

Since BFG depends on no particular persistence mechanism, BFG has no built-in 
session support, although I often use this pair of packages to get it:

http://pypi.python.org/pypi/repoze.browserid/0.1
http://pypi.python.org/pypi/repoze.session/0.2

Of course any sessioning system would work just as well (ala Beaker).

 If you are thinking of adding such a thing to bfg, I'll hold off on my
 own ( or use a really crappy one ).

No, I'm not.

 Can we set a simple cookie with
 webob maybe as an ultralight version that doesn't depend on a particular
 method of storing session vars?

Sure, although I'm not sure that requires any particular API support from BFG.

- C
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev