File tree 2 files changed +9
-7
lines changed 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 10
10
from werkzeug .exceptions import HTTPException
11
11
import re
12
12
import sys
13
- from flask import __version__ as flask_version
13
+ from compat import is_flask_legacy
14
14
15
15
16
16
api_resources = Blueprint (
@@ -89,8 +89,7 @@ def handle_user_exception(self, e):
89
89
if handlers is not None :
90
90
blueprint_handlers = handlers .get (None , ())
91
91
app_handlers = self .error_handler_spec [None ].get (None , ())
92
- flask_version .split ()
93
- if self .get_minor_version () <= 10 :
92
+ if is_flask_legacy ():
94
93
for typecheck , handler in chain (blueprint_handlers , app_handlers ):
95
94
if isinstance (e , typecheck ):
96
95
return handler (e )
@@ -123,7 +122,3 @@ def create_url_adapter(self, request):
123
122
self .config ['SERVER_NAME' ],
124
123
script_name = self .config ['APPLICATION_ROOT' ] or '/' ,
125
124
url_scheme = self .config ['PREFERRED_URL_SCHEME' ])
126
-
127
- @staticmethod
128
- def get_minor_version ():
129
- return int (flask_version .split ("." )[1 ])
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
from __future__ import unicode_literals , absolute_import
3
+ from flask import __version__ as flask_version
3
4
4
5
# Markdown is optional
5
6
try :
@@ -16,5 +17,11 @@ def apply_markdown(text):
16
17
md = markdown .Markdown (extensions = extensions , safe_mode = safe_mode )
17
18
return md .convert (text )
18
19
20
+
19
21
except ImportError :
20
22
apply_markdown = None
23
+
24
+
25
+ def is_flask_legacy ():
26
+ v = flask_version .split ("." )
27
+ return int (v [0 ]) == 0 and int (v [1 ]) < 11
You can’t perform that action at this time.
0 commit comments