Django 1.2 Validation breaks __eq__ on Recurrance Model

Bug #729407 reported by Joe Jasinski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
django-recurrence
Fix Committed
Undecided
tamask

Bug Description

Was having some difficulty with Django Recurrence when upgrading to Django 1.2. Django added model validators which breaks the 'in' check below. Putting a typecheck at the beginning of the __eq__ method seems to solve it. Still testing. See the PROPOSED CHANGE BELOW for more info.

DJANGO 1.2 SOURCE - Django-1.2.5-py2.5.egg/django/db/models/fields/__init__.py
       ....
 191 if not self.blank and value in validators.EMPTY_VALUES:
 192 raise exceptions.ValidationError(self.error_messages['blank']

PROPOSED CHANGE BELOW

class Recurrence(object):
    ....
    ....
    def __eq__(self, other):
        if type(other) != type(self): # <- Added
            return False #<- Added

        if not isinstance(other, Recurrence):
            raise TypeError('object to compare must be Recurrence object')
        return hash(self) == hash(other)

tamask (tamask)
Changed in django-recurrence:
status: New → In Progress
assignee: nobody → tamask (tamask)
tamask (tamask)
Changed in django-recurrence:
status: In Progress → Fix Committed
Revision history for this message
Joe Jasinski (joe-jasinski) wrote :

Thanks Tamas

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.