On 2/4/12 1:47 PM, Chris McDonough wrote:
> 
> No, you still have to use @view_config(name=..) for each method, there's
> no implicit method-name to name= mapping.

Ok, that is what I thought.

> Without @view_defaults I'd expect your example above to translate to:
> 
> class UpdateHandler(object):
>     ....
>     @view_config(context=A, name='update', predicates...):
>     def update1(self):
>         ....
> 
>     @view_config(context=B, name='update', predicates...):
>     def update2(self):
>         ....
> 
> Is that your expectation?  When you do it like that instead of using
> view_defaults, do you get the same outcome?

Yes, when I do it like this I get what I expect.

When I define the context=A in the view_defaults and don't put it in
explicitly in update1, then the update1 view is not found for resources
of type A. So I guess the view_config of update2 overwrites the default
context.

> For the record, you really do need to use 1.3a5+; there was a bug in
> @view_defaults before then that made it not work right.


I'm using 1.3a6.

> View mappers can be used to do all sorts of rearranging, yes.

Ok, I'll go for this then.

Cheers,
Benjamin

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to