Пример #1
0
 def decorated_function(*args, **kwargs):
     p = flask.request.path
     browser_check = p.endswith('/') or p.endswith('.html')
     browser_check = browser_check and not p.startswith('/test/')
     if browser_check:
         try:
             agent = util.user_agent()
             if agent['is']['mobile']:
                 return flask.abort(406)
             if not util.check_browser(agent):
                 return flask.abort(406)
         except KeyError:
             return flask.abort(406)
     return f(*args, **kwargs)
Пример #2
0
 def decorated_function(*args, **kwargs):
   p = flask.request.path
   browser_check = p.endswith('/') or p.endswith('.html')
   browser_check = browser_check and not p.startswith('/test/')
   if browser_check:
     try:
       agent = util.user_agent()
       if agent['is']['mobile']:
         return flask.abort(406)
       if not util.check_browser(agent):
         return flask.abort(406)
     except KeyError:
       return flask.abort(406)
   return f(*args, **kwargs)