Tomasz Nazar wrote:
>
>
> On 8/24/07, *Christoph Haas* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> > As I understand 'c' is always reset before any controller's
> action - what is
> > not fun for me, as in my app one "user" request/click is often 2
> (or more)
> > Pylons controllers' actions, hence http redirects..
>
> Without knowing your application I dare say that this sounds like you
> are using redirect_to in the wrong places. If the application is
> supposed to do multiple things when a user does a certain HTTP request
> then why can't one controller's action do that alone?
>
> Christoph
>
>
> Simple said, because of the duplication of some parts of the code.
>
>
> Let's have this example from my app for discussion:
>
> Usecase 1: "Go to Home Page" -> issues 'controller: home/home' ->
> renders 'home.mako'
> Usecase 2: "Send email to a friend, and show Home Page" -> issues
> 'controller: email/send', then redirects to 'controller: home/home' ->
> renders ' home.mako'
>
> Of course 'home' action of controller 'home' does some specific logic,
> like showing current user's data from DB. That is a reason, I just
> can't show 'home.mako' in 'email/send' page after sending an email.
>
> And it is really bad to implement that logic twice in different places..
Rather then using return redirect_to('home') in your email controller,
why not just call home directly return self.home(), of course that
assumes that home and email are in the same controller which they might
not be, but you should be able to simply import what ever actions you
need from waht ever controllers you you've already written. Or did I
miss something very fundamental in the the conversation?
Jose
>
>
> Though I sometimes handle such situations by just _calling_ (not
> redirecting) 2nd action from a controller, only when 2 actions used
> are in the same controller.
> Hmm...however when I think about that now, I think I could also not to
> redirect, but could try to call 'home/home' action from another
> controller ('email') class/object.. could I? Can I access that object
> somehow?
>
> Tomasz
>
> ps. session is somehow too global for my needs. That's 'c' is the
> thing to use I think
> ps2. In Java/Struts I've used "forms" for storing that kind of data,
> that is nor "sesion global", nor "http request specific".
>
> --
> _i______'simplicity_is_the_key'__________tomasz_nazar
> _ii____'i_am_concern_oriented'________________JKM-UPR
> _iii__'patsystem.sf.net <http://patsystem.sf.net>
> '___________________linux_user
> _'aspectized.com
> <http://aspectized.com>'___________________________prevayler
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---