On Sep 12, 10:48 pm, Freewind <[email protected]> wrote:
> Thank you both, but this is not what I want.
>
> I know I can define the routes to let the action have more parameters
> in pylons, but in turbogears, we don't need to configure the routes.
>
> It seems turbogears can scan the parameters names of an action, and
> get those values from request.params, then set to the action.
>
> For example, if there is an action:
>
>     def create_user(self, email, password, nickname):
>          ...
>
> When user request the 'create_user' action, turbogears knows it has 3
> parameters(email, password, nickname), so it will look up them in
> request.params. If found, then pass them to the action.
>
> So we can use them directly, without "email =
> request.params['email']; ...". And, we don't need to config the
> routes! It's automatic.
>
> I think this is much better and clear than the way we used in pylons.
> And I hope I can do the same in pylons.

Personally, I don't think the TG way is better, more clear, or more
convenient. I don't think it's necessarily worse, either. It's more a
matter of preference, though I'm sure there are passionate Believers
in both.

I'm not sure how you'd go about using TG's style of URL dispatch in
Pylons, but I'm sure it's possible. Would it be worth the effort,
though, or would you be better off just using TG?



> On 9月13日, 上午1时55分, Graham Higgins <[email protected]> wrote:
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
>
> > On 11 Sep 2010, at 16:37, Freewind wrote:
>
> > > I'm using pylons, and my action of controller is:
>
> > > class UserController(BaseController):
>
> > >      def create(self):
> > >           name = request.POST['name']
> > >           email = request.POST['email']
> > >           password = request.POST['password']
> > >           ...
> > > But I found in turbogears, I can do like this:
>
> > > class UserController:
>
> > >      def create(self, name, email, password):
> > >           ...
> > > How to do the same in pylons?
>
> > This is covered in the Pylons documentation here:
>
> >http://pylonshq.com/docs/en/1.0/configuration/#url-configuration
>
> > the Routes documentation here:
>
> >http://routes.groovie.org/setting_up.html
>
> > and the routing and dispatch of URLs has a chapter of its own in the  
> > Pylons book:
>
> >http://pylonsbook.com/en/1.1/urls-routing-and-dispatch.html
>
> > - --
> > Cheers,
>
> > Graham
>
> >http://www.linkedin.com/in/ghiggins
>
> > -----BEGIN PGP SIGNATURE-----
>
> > iEYEARECAAYFAkyNFBIACgkQOsmLt1NhivwXqACbB/MYJ9WK9/yowk4XIW9AczGM
> > VuEAnRTJKBSnF3JgzikD9A86R6lVDU9riQCVAgUBTI0UElnrWVZ7aXD1AQJQdQP/
> > ZuCChKztjXpUUAfjUEDZd7LA4p02g8ROcP2BqgUxnexuIFzyHBxmKBZHSCv+1mS4
> > I13Hc2Ess8uhkNcyZWfe7P7OiLBBlEhzcIlmIFyLfOuVuLTwzk3rQb3K7xM60rt9
> > CD3Bu+9sAI01IESJsNA6AEss1dvWw6BV+dW7I5vMaSI=
> > =BZpr
> > -----END PGP SIGNATURE------ 隐藏被引用文字 -
>
> > - 显示引用的文字 -

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