Hi,

On Thu, Apr 7, 2011 at 4:47 PM, Eric Lemoine
<[email protected]> wrote:
> Hi
>
> I have view class defined as follows:
>
> class Entry(object):
>    def __init__(self, request):
>        self.request = request
>        self.debug = "debug" in request.params
>        lang = request.params.get("lang",
>                    request.registry.settings.get("default_locale_name"))
>        self.lang = lang
>
>    @view_config(route_name='home', renderer='templates/index.html')
>    def home(self):
>        return {'lang': self.lang, 'debug': self.debug}
>
>
> And a route to the "home" action defined with this:
>
> config.add_route('home', '/', view_attr='home')
>

Don't know why you are using two different configuration. add_route
and view_config do the "same" thing. Eg: add an entry to the registry.

You just need to use add_route:

config.add_route('home', '/', view_attr='home',
view='yourmodule.Entry', renderer='...')

>
> But Pyramid complains:
>
> pyramid.exceptions.ConfigurationError: view_attr argument not
> permitted without view argument
>
>
> The thing is I'd like to specify the renderer through the view_config
> decorator, so it is defined as close as possible to my "home" def. But
> using add_route, and binding view_config and add_route together
> through the route_name attribute, doesn't work either.
>
> Is there a solution to this problem?
>
> Thanks,
>
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : [email protected]
> http://www.camptocamp.com
>
> --
> 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.
>
>

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