Thanks for all the replies!

Actually I had concern about instantiating a new controller. Not sure if it
is proper to make it in the template.
However, I still think something like RenderAction() in Asp.NET MVC might be
usefull.

In my example, I use CommentController\list action to render a paged list of
comments, which returns partial html to client upon ajax calls. In the
MovieController\view action, it needs to show the 1st page of the comments.
Hence, it seems to me that the most concise way is to have the return value
of the CommentController\list action in the Movie\view.mako template.

Is there another suggestion?

On Sun, Mar 28, 2010 at 10:42 PM, Mike Orr <[email protected]> wrote:

>
> I would use 'self' rather than instantiating the controller anew.
> Pylons may set instance attributes in the controller, and future
> versions will probably to more of this.  You can, for instance, do one
> of these:
>
> c.comments = self.list()
> c.controller = self
> c.list_action = self.list
>
> However, if you're concern is duplicated controller code, you should
> probably factor that code into a utility method and call it from both
> actions.
>
> If your concern is repeating a query, then you'd have to refactor your
> code further.
>
> --
> Mike Orr <[email protected]>
>
> --
> 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]<pylons-discuss%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.
>
>

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

Reply via email to