On Feb 11, 2010, at 2:27 PM, Matthew Burgess wrote:
> I'm at the stage of setting up the routes, and the tutorial tells me to
> replace all of the default custom routes with:
>
> map.connect(':controller/:action/:title', controller='page',
> action='index', title='FrontPage')
> map.connect(':title', controller='page', action='index',
> title='FrontPage')
> map.connect('*url', controller='template', action='view')
>
> This ends up in me reaching a server error page, as the 'template' module
> can't be found when I hit http://localhost:5000/.
Ah, those should be replaced with proper routes. Ie, adding things like:
map.connect('/page/{action}/{title}'....)
No reason to take the controller arg since it specifies it.
> then I get to the page controller, but I hit another server error:
>
> AttributeError: 'ContextObj' has no attribute 'title'
>
> Now, the QuickWiki tutorial states that:
>
> "Pylons automatically assigns all the action parameters to the Pylons context
> object c so that you don't have to assign them yourself. In this case, the
> value of title will be automatically assigned to c.title so that it can be
> used in the templates. We assign c.content manually in the controller."
This is no longer the default behavior. Not only is the default to not
auto-assign the vars, but its also not the default to allow access to
attributes that don't exist on the tmpl_context (c obj). So the QuickWiki
should be updated to assign the needed variables to the 'c' object in the
controller.
Thanks for helping out!
Cheers,
Ben
--
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.