Skip to content

Commit 725e80b

Browse files
authored
Merge pull request #17 from borisowww/fix-file-validation
TypeError: __init__() got an unexpected keyword argument 'min_length'
2 parents d916377 + 16b207a commit 725e80b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ All parameters can have default values, and automatic validation.
9090

9191
These validators are passed into the classes in the route function, such as:
9292
* `username: str = Json("defaultusername", min_length=5)`
93-
* `profile_picture: Any = File(content_types=["image/png", "image/jpeg"])`
93+
* `profile_picture: werkzeug.datastructures.FileStorage = File(content_types=["image/png", "image/jpeg"])`
9494
* `filter: str = Query()`
9595

9696
### Overwriting default errors

flask_parameter_validation/parameter_types/file.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ def __init__(
1616
min_length=None, # Minimum file content-length
1717
max_length=None # Maximum file content-length
1818
):
19-
super().__init__(default, min_length=min_length, max_length=max_length)
20-
self.content_types = content_types # Array of content type strs
19+
super().__init__(default)
20+
self.content_types = content_types
21+
self.min_length = min_length
22+
self.max_length = max_length
2123

2224
def validate(self, value):
2325
# Content type validation

0 commit comments

Comments
 (0)