Skip to content

Commit

Permalink
type ignore monkey patched configuration object
Browse files Browse the repository at this point in the history
  • Loading branch information
jugmac00 committed May 21, 2021
1 parent 825d900 commit af5ca6e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/flask_uploads/flask_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def configure_uploads(app: Flask, upload_sets: Iterable['UploadSet']) -> None:
upload_sets = (upload_sets,)

if not hasattr(app, 'upload_set_config'):
app.upload_set_config = {}
set_config = app.upload_set_config
app.upload_set_config = {} # type: ignore
set_config = app.upload_set_config # type: ignore
defaults = dict(
dest=app.config.get('UPLOADS_DEFAULT_DEST'),
url=app.config.get('UPLOADS_DEFAULT_URL')
Expand Down Expand Up @@ -214,7 +214,7 @@ def config(self) -> 'UploadConfiguration':
return self._config
try:
upload_configuration = (
current_app.upload_set_config[self.name]
current_app.upload_set_config[self.name] # type: ignore
) # type: UploadConfiguration
return upload_configuration
except AttributeError:
Expand Down Expand Up @@ -368,7 +368,7 @@ def resolve_conflict(self, target_folder: str, basename: str) -> str:

@uploads_mod.route('/<setname>/<path:filename>')
def uploaded_file(setname: UploadSet, filename: str) -> Any:
config = current_app.upload_set_config.get(setname)
config = current_app.upload_set_config.get(setname) # type: ignore
if config is None:
abort(404)
return send_from_directory(config.destination, filename)

0 comments on commit af5ca6e

Please sign in to comment.