thanks Anthony....

@View('path/to/file')
def example():
     return locals()

implement this decorator is based on my personal taste....


2013/8/22 Anthony <[email protected]>

>
> from gluon import current
>> response = current.response
>>
>> class View(object):
>>        def __init__(self, path):
>>             ........
>>         def __call__(self, fn):
>>             def _call():
>>                  response.view = self.path
>>
>
> No, don't do that. If you assign current.response to response at the top
> level in the module, it will not be updated on each request. Instead, in
> the _call() function, do current.response.view = self.path.
>
> Anyway, I agree with Niphod -- this seems like a completely gratuitous use
> of a decorator.
>
> Anthony
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/ljp1IcabuSE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to