saisasthaa / django-cron

Automatically exported from code.google.com/p/django-cron
MIT License
0 stars 0 forks source link

exception thrown when run_every is changed between two cron runs #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a subclass of cron.Cron with run_every set to e.g. 1
2. let django-cron execute at least once, so the cron_cron table gets populated
3. change the run_every property to something else, e.g. to 2
4. let django-cron execute again. See exception "cron.models.DoesNotExist:
CronType matching query does not exist."

Reason for this is that in models.py line 13, the value of run_every is
used in the get_or_create() call. The exception occurs because the database
already contains an object with the same name, but a different value. Since
the name column is marked as unique, Django can't create that object.

The attached patch fixes that issue by not using run_every in the
get_or_create call, but setting it explicitely later.

Original issue reported on code.google.com by chris.vigelius on 16 Jun 2008 at 9:59

Attachments:

GoogleCodeExporter commented 9 years ago
This is fixed now that I have updated the app to work with django 1.0

Original comment by digitalx...@gmail.com on 19 Nov 2008 at 8:01