Browse Source

crontab repr of string '0' should be *. Closes #972

Ask Solem 12 years ago
parent
commit
2920895092
1 changed files with 9 additions and 5 deletions
  1. 9 5
      celery/schedules.py

+ 9 - 5
celery/schedules.py

@@ -35,6 +35,10 @@ int, basestring, or an iterable type. {type!r} was given.\
 """
 
 
+def weak_bool(s):
+    return 0 if s == '0' else s
+
+
 class ParseException(Exception):
     """Raised by crontab_parser when the input can't be parsed."""
 
@@ -423,11 +427,11 @@ class crontab(schedule):
 
     def __repr__(self):
         return ('<crontab: %s %s %s %s %s (m/h/d/dM/MY)>' %
-                                            (self._orig_minute or '*',
-                                             self._orig_hour or '*',
-                                             self._orig_day_of_week or '*',
-                                             self._orig_day_of_month or '*',
-                                             self._orig_month_of_year or '*'))
+                        (weak_bool(self._orig_minute) or '*',
+                         weak_bool(self._orig_hour) or '*',
+                         weak_bool(self._orig_day_of_week) or '*',
+                         weak_bool(self._orig_day_of_month) or '*',
+                         weak_bool(self._orig_month_of_year) or '*'))
 
     def __reduce__(self):
         return (self.__class__, (self._orig_minute,