hi all.

i'm trying implement response.view as a decorator, but not work my code:
for example i wanna do it:

@View('path/sub_path/view.html')
def index()
      return locals()

in modules i have :  decorator.py

from gluon.globals import Response
response = Response()

class Error(Exception):
    ''' Error if path != str''

class View(object):
       
    def __init__(self, path):
        if isinstance(path, str):
            self.path = path
        else:
            raise Error('{} no es una cadena'.format(path))
            
    def __call__(self, fn):
        def _call():
           ## fn.func_globals[response.view] = self.path
           respomse.view = self.path
           return fn()
        return _call

in default.py :

from decorador import View

@View('layout.html')
def exampler():
    '''para llamar una vista de cualquier directorio'''
    return locals()

but not found !!!.... why ?

not want to put on each controller response.view = 'example'.... ! help !!



-- 

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