Ticket #2261: base.py.patch

File base.py.patch, 418 bytes (added by anonymous, 18 years ago)

patch to add a hash impl to Model

  • base.py

    old new  
    7777    def __eq__(self, other):
    7878        return isinstance(other, self.__class__) and self._get_pk_val() == other._get_pk_val()
    7979
     80    def __hash__(self):
     81        return hash('%s%s' % (hash(self.__class__), self._get_pk_val()))
     82
    8083    def __ne__(self, other):
    8184        return not self.__eq__(other)
    8285
Back to Top