diff rhodecode/lib/hooks.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 47631be9f449
children 55585c86be83
line wrap: on
line diff
--- a/rhodecode/lib/hooks.py	Thu Mar 28 01:10:45 2013 +0100
+++ b/rhodecode/lib/hooks.py	Thu Mar 28 01:10:45 2013 +0100
@@ -143,7 +143,7 @@
         kw.update(ex)
         callback(**kw)
 
-    if ex.make_lock is True:
+    if ex.make_lock:
         Repository.lock(Repository.get_by_repo_name(ex.repository), user.user_id)
         #msg = 'Made lock on repo `%s`' % repository
         #sys.stdout.write(msg)
@@ -202,7 +202,7 @@
         kw.update(ex)
         callback(**kw)
 
-    if ex.make_lock is False:
+    if not ex.make_lock:
         Repository.unlock(Repository.get_by_repo_name(ex.repository))
         msg = 'Released lock on repo `%s`\n' % ex.repository
         sys.stdout.write(msg)