The particular problem is diagnosed below, but I'll first echo the
recommendation to use Pyramid for new projects. Pyramid is "Pylons 2".
Pylons 1 has been in bugfix-only mode for a year, and is really only
maintained to support existing deployments. Pyramid has significantly
more thorough documentation. That was one of the reasons we switched:
both because the codebase was more flexible and offered new features,
and also because the documentation was more complete so we didn't have
to fill in the holes ourselves.

On Mon, May 28, 2012 at 9:59 PM, Pinakee Biswas <[email protected]> wrote:
> #@restrict('POST')
>    @validate(schema=NewPageForm(), form='new')
>    def create(self):
>        # Add the new page to the database
>        page = model.Page()
>        for k, v in self.form_result.items():
>            setattr(page, k, v)

> Module simplesite.controllers.page:66 in create          view
>>>  for k, v in self.form_result.items():
> AttributeError: 'PageController' object has no attribute 'form_result'

The validate decorator sets the 'form_result' attribute, but it
bypasses validation if the request is a GET, which would lead to that
error. (I've never understood why it defaults to this.) There's an
argument to 'validate' to make it validate GET requests, see the
source docstring (pylons.decorators.validate), especially the 'on_get'
and 'post_only' args.

As to why it's occurring now, there may have been changes to
'validate' since Pylons 0.9.7 (which the book was written for). Or are
using GET in a situation where the tutorial assumes POST?

-- 
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].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to