Permalink
Browse files

Comparisons of generations should be done based on id

Using == to test equality of Generation objects is fine,
but comparisons like < use the meaningless default
comparator.  Compare based on the id column instead.
  • Loading branch information...
1 parent 9337f30 commit 5c5f4325ebf7f216fec270c532862c8533e1ee1d @mhl mhl committed Jan 14, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 mapit/management/commands/mapit_delete_areas_from_new_generation.py
@@ -42,7 +42,7 @@ def handle(self, **options):
print " ... deleted."
else:
print " ... not deleting, since --commit wasn't specified"
- elif area.generation_low < new and area.generation_high == new:
+ elif area.generation_low.id < new.id and area.generation_high == new:
print " ... still exists in an earlier generation, so lowering generation_high to", previous_generation
area.generation_high = previous_generation
if options['commit']:
@@ -51,7 +51,7 @@ def handle(self, **options):
else:
print " ... not lowering, since --commit wasn't specified"
- elif area.generation_high > new:
+ elif area.generation_high.id > new.id:
# This should never happen - it'd mean the
# implementation of Generation.objects.new() has
# changed or something else is badly wrong:

0 comments on commit 5c5f432

Please sign in to comment.