#275 closed defect (fixed)
Missing arg in django.core.validators.RequiredIfOtherFieldGiven introduced by changeset 403
Reported by: | jhernandez | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | normal | 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 (last modified by )
in line 240 of django/core/validators.py the get() method is invoked with less arguments than the required:
In method call of class RequiredIfOtherFieldsGiven :
def __call__(self, field_data, all_data): for field in self.other: if all_data.get(field) and not field_data: raise ValidationError, self.error_message
looking at the call method of the class RequiredIfOtherFieldNotGiven, the get() method is invoked in this way:
if not all_data.get(self.other, False) and not field_data:
maybe the missed argument is just False
, but I'm not sure :-(
This breaks the edit_inline example in tutorial02.
This is the traceback generated when you call "save" on the add poll form:
There's been an error: Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/django/core/handlers/base.py", line 63, in get_response return callback(request, **param_dict) File "/usr/lib/python2.3/site-packages/django/views/admin/main.py", line 765, in add_stage errors = manipulator.get_validation_errors(new_data) File "/usr/lib/python2.3/site-packages/django/core/formfields.py", line 70, in get_validation_errors validator(new_data.get(field.field_name, ''), new_data) File "/usr/lib/python2.3/site-packages/django/core/validators.py", line 240, in __call__ if all_data.get(field) and not field_data: TypeError: get() takes exactly 3 arguments (2 given)
Change History (3)
comment:1 by , 19 years ago
Component: | Admin interface → Core framework |
---|
comment:2 by , 19 years ago
Description: | modified (diff) |
---|
comment:3 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I selected the wrong component, not to metion the missing formating, next time I'll do better.