Exemple #1
0
    def decorated_view(*args, **kwargs):
        found_ = False
        for i in al_separation:
            if  ((current_user.access_level in i['access_levels']) or (-1 in i['access_levels'])) \
                 and (i['endpoint'] == request.endpoint):
                found_ = True
                break

        if found_:
            return func(*args, **kwargs)
        else:
            return common_response(status=401,
                                   err_msg='Access level unauthorized')
        def exception_handler(error):
            print("Printing traceback........")
            logger = CreateLogger(__name__, app.config.get('SERVER_LOG'))
            meth = request.method
            url = request.url
            ip_addr = request.remote_addr

            x = traceback.format_exception(type(error), error, error.__traceback__)
            a = "[Url: '%s', Method: '%s', ip_addr: '%s'] === " % (url, meth, ip_addr)
            for i in x:
                a = a + str(i)

            logger.critical(a)

            return common_response(status=500, err_msg='Internal server error')
 def _405(e):
     return common_response(status=405, err_msg='Method not allowed')
 def _404(e):
     return common_response(status=404, err_msg='Not Found')
Exemple #5
0
def codedeploy():
    for key, val in request.form.items():
        print("%s:%s" % (key, val))

    return common_response(data={'hello':'world'})
Exemple #6
0
def error_500():
    x = 2/0

    return common_response(data={'hello':'world'})