Venusian is now "better" and stuff. By this I mean it now requires you to
send a depth argument when wrapping decorators such that the depth reflects
how far away the actual user function is in the call stack from the
decorator. For example:

class my_view_config(object):
    def __init__(self, route_name, renderer=None, permission=None, **kw):
        kw['route_name'] = route_name
        kw['renderer'] = renderer
        kw['permission'] = permission
        kw.setdefault('_depth', 1) # the 1 indicates we have put
view_config one level further away from the wrapped object
        self.kw = kw

    def __call__(self, wrapped):
        return view_config(**self.kw)(wrapped)


On Tue, Dec 18, 2012 at 3:42 PM, Mike Orr <[email protected]> wrote:

> What's the easiest way to make an @view_config wrapper decorator? I
> saw the _depth argument in Pyramid 1.4 but I'm not sure how to use it.
> What I want to do is to define:
>
> @my_view_config(route_name, renderer=None, permission=None, **kw)
>     # First three are positional args, first one is required.
>     # Preprocess the 'renderer' value; e.g., adding a "templates/" prefix.
>     # Pass the modified args to @view_config.
>
> Can I do this by just returning view_config(...) or do I have to make
> a custom function and return it? If so, should I use one of the
> decorator helpers?
>
> --
> 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.
>
>

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