def auth_view(method):
    '''
    role for view.
    '''

    def wrapper(self, *args, **kwargs):
        '''
        wrapper.
        '''

        if ROLE_CFG['view'] == '':
            return method(self, *args, **kwargs)
        elif self.current_user:
            if is_prived(self.userinfo.role, ROLE_CFG['view']):
                return method(self, *args, **kwargs)
            else:
                kwd = {
                    'info': 'No role',
                }
                self.render('misc/html/404.html',
                            kwd=kwd,
                            userinfo=self.userinfo)

        else:
            kwd = {
                'info': 'No role',
            }
            self.render('misc/html/404.html',
                        kwd=kwd,
                        userinfo=self.userinfo)

    return wrapper
def auth_view ( method ) : def wrapper ( self , * args , ** kwargs ) : if ROLE_CFG [ 'view' ] == '' : return method ( self , * args , ** kwargs ) elif self . current_user : if is_prived ( self . userinfo . role , ROLE_CFG [ 'view' ] ) : return method ( self , * args , ** kwargs ) else : kwd = { 'info' : 'No role' , } self . render ( 'misc/html/404.html' , kwd = kwd , userinfo = self . userinfo ) else : kwd = { 'info' : 'No role' , } self . render ( 'misc/html/404.html' , kwd = kwd , userinfo = self . userinfo ) return wrapper
role for view.