def wrapped_f(*args, **kwargs): if session.get('user', None): resp = Response( True, "Opération interdite vous n'êtes pas déconnecté !") return json_response(resp.json(), status_code=403) else: return f(*args, **kwargs)
def wrapped_f(*args, **kwargs): try: return f(*args, **kwargs) except Exception as e: timestamp = time.strftime('%d%m%H%M%S') desc = '`mapif.{0}()` at `{1}` error: details below.'.format( f.__name__, timestamp) modlgr.exception(desc) code = '{0}.{1}'.format(err_code, timestamp) resp = Response(has_error=True, code=code, content='') return json_response(resp.json(), status_code=500)
def wrapped_f(*args, **kwargs): try: return f(*args, **kwargs) except Exception as e: timestamp = time.strftime('%d%m%H%M%S') desc = '`mapif.{0}()` at `{1}` error: details below.'.format( f.__name__, timestamp ) modlgr.exception(desc) code = '{0}.{1}'.format(err_code, timestamp) resp = Response(has_error=True, code=code, content='') return json_response(resp.json(), status_code=500)
def wrapped_f(*args, **kwargs): if session.get('user', None): resp = Response(True, "Opération interdite vous n'êtes pas déconnecté !") return json_response(resp.json(), status_code=403) else: return f(*args, **kwargs)