Opened 9 years ago

Closed 9 years ago

Last modified 8 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: UI/UX:

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 Changed 9 years ago by anonymous

  • milestone set to Version 0.91
  • Version set to 0.9

comment:2 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:3 Changed 8 years ago by adrian

  • milestone Version 0.91 deleted

Milestone Version 0.91 deleted

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