Mercurial > kallithea
comparison rhodecode/lib/celerylib/__init__.py @ 3625:260a7a01b054 beta
follow Python conventions for boolean values
True and False might be singletons and the "default" values for "boolean"
expressions, but "all" values in Python has a boolean value and should be
evaluated as such. Checking with 'is True' and 'is False' is thus confusing,
error prone and unnessarily complex.
If we anywhere rely and nullable boolean fields from the database layer and
don't want the null value to be treated as False then we should check
explicitly for null with 'is None'.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 28 Mar 2013 01:10:45 +0100 |
parents | 27525c5fbc36 |
children | 3563bb7b4b82 |
comparison
equal
deleted
inserted
replaced
3624:4dddb7ee8865 | 3625:260a7a01b054 |
---|---|
122 def __wrapper(func, *fargs, **fkwargs): | 122 def __wrapper(func, *fargs, **fkwargs): |
123 try: | 123 try: |
124 ret = func(*fargs, **fkwargs) | 124 ret = func(*fargs, **fkwargs) |
125 return ret | 125 return ret |
126 finally: | 126 finally: |
127 if CELERY_ON and CELERY_EAGER is False: | 127 if CELERY_ON and not CELERY_EAGER: |
128 meta.Session.remove() | 128 meta.Session.remove() |
129 | 129 |
130 return decorator(__wrapper, func) | 130 return decorator(__wrapper, func) |