Re: [Django] #9786: Files (and subclasses) override __eq__ but not __ne__

2008-12-15 Thread Django
#9786: Files (and subclasses) override __eq__ but not __ne__
-+--
  Reporter:  xtian   | Owner:  nobody
Status:  closed  | Milestone:
 Component:  Database layer (models, ORM)|   Version:  SVN   
Resolution:  fixed   |  Keywords:
 Stage:  Unreviewed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by mtredinnick):

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => fixed
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 Fixed in r9647.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #9786: Files (and subclasses) override __eq__ but not __ne__

2008-12-09 Thread Django
#9786: Files (and subclasses) override __eq__ but not __ne__
+---
 Reporter:  xtian <[EMAIL PROTECTED]>  |   Owner:  nobody
   Status:  new |   Milestone:
Component:  Database layer (models, ORM)| Version:  SVN   
 Keywords:  |   Stage:  Unreviewed
Has_patch:  0   |  
+---
 We were trying to compare two model objects using the following function:

 {{{

 def allModelFieldsEqual(a, b):
 fields = [f.name for f in a._meta.fields]
 for name in fields:
 if getattr(a, name) != getattr(b, name):
 return False
 return True

 }}}

 This fails when the models contain FileFields, because File doesn't
 implement __ne__. Confusingly, because it implements __eq__, the values
 also compare equal.

 {{{
 (Pdb) !a.largeImage
 
 (Pdb) !b.largeImage
 
 (Pdb) !a.largeImage == b.largeImage
 True
 (Pdb) !a.largeImage != b.largeImage
 True
 }}}

 It should probably be implemented as:
 {{{
 def __ne__(self, other):
 return not self == other
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---