File tree 1 file changed +10
-7
lines changed
1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -284,16 +284,19 @@ def __init__(
284
284
elif isinstance (server , bool ):
285
285
name = name if name else "__main__"
286
286
self .server = flask .Flask (name ) if server else None
287
- if self .server is not None and _flask_compress_version >= parse_version (
288
- "1.6.0"
289
- ):
290
- # flask-compress==1.6.0 changed default to ['br', 'gzip']
291
- # and non-overridable default compression with Brotli is
292
- # causing performance issues
293
- self .server .config ["COMPRESS_ALGORITHM" ] = ["gzip" ]
294
287
else :
295
288
raise ValueError ("server must be a Flask app or a boolean" )
296
289
290
+ if (
291
+ self .server is not None
292
+ and not hasattr (self .server .config , "COMPRESS_ALGORITHM" )
293
+ and _flask_compress_version >= parse_version ("1.6.0" )
294
+ ):
295
+ # flask-compress==1.6.0 changed default to ['br', 'gzip']
296
+ # and non-overridable default compression with Brotli is
297
+ # causing performance issues
298
+ self .server .config ["COMPRESS_ALGORITHM" ] = ["gzip" ]
299
+
297
300
base_prefix , routes_prefix , requests_prefix = pathname_configs (
298
301
url_base_pathname , routes_pathname_prefix , requests_pathname_prefix
299
302
)
You can’t perform that action at this time.
0 commit comments