Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#1009 closed defect (fixed)

Small bug in HasAllowableSize Validator

Reported by: bsoltani3@… Owned by: Anybody
Component: Validators Version: 0.90
Severity: minor Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When I meant small, I meant really really tiny. The last line in the init definition references min_size when it should reference max_size

class HasAllowableSize:
    """
    Checks that the file-upload field data is a certain size. min_size and
    max_size are measurements in bytes.
    """
    def __init__(self, min_size=None, max_size=None, min_error_message=None, max_error_message=None):
        self.min_size, self.max_size = min_size, max_size
        self.min_error_message = min_error_message or lazy_inter(gettext_lazy("Make sure your uploaded file is at least %s bytes big."), min_size)
        self.max_error_message = max_error_message or lazy_inter(gettext_lazy("Make sure your uploaded file is at most %s bytes big."), min_size)

That should actually be

 self.max_error_message = max_error_message or lazy_inter(gettext_lazy("Make sure your uploaded file is at most %s bytes big."), max_size)

Technically it should be self.max_size, but it doesn't make a difference.

Change History (3)

comment:1 by anonymous, 19 years ago

milestone: Version 0.91
Version: 0.9

comment:2 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: newclosed

(In [1564]) Fixed #1009 -- Fixed small typo in HasAllowableSize validator. Thanks, bsoltani

comment:3 by Adrian Holovaty, 18 years ago

milestone: Version 0.91

Milestone Version 0.91 deleted

Note: See TracTickets for help on using tickets.
Back to Top