jugmac00 / flask-reuploaded

File uploads for Flask.
https://github.com/jugmac00/flask-reuploaded
MIT License
63 stars 12 forks source link

Deprecate `default_dest` parameter #140

Open tabebqena opened 2 years ago

tabebqena commented 2 years ago

The UploadSet accepts an optional parameter default_dest. I think that this parameter has nothing to add in the presence of UPLOADS_PHOTOS_DEST and UPLOADS_DEFAULT_DEST.

Also, there is no special use case for it as far as I know.

jugmac00 commented 2 years ago

I am hestitating to deprecate the parameter and finally to remove it, as that would cause a backwards imcompatibility.

Any more opinions on this?

tabebqena commented 2 years ago

I think that there is many drawbacks result ing from the backward compatibility. Also, You should hesitate :) because a lot of changes will make scope creeping.

In the default_dest parameter, I may suggest removing it without throwing a special error. just the code will not work. Something like changing :

     `def __init__( self, name: str = 'files', extensions: Iterable[str] = DEFAULTS, default_dest: Optional[Callable[[Flask], str]] = None) -> None:`

To

     `def __init__( self, name: str = 'files', extensions: Iterable[str] = DEFAULTS, **kwargs) -> None:`

We should add warning in the function body.

This is better than removing it from the method signature:

 `def __init__( self, name: str = 'files', extensions: Iterable[str] = DEFAULTS) -> None:`

As, this will throw error to all users, even those that write:

`uset = UploadSet(name='files', default_dest=None)`

This is just an idea on how to remove it without noisy.