[Python-checkins] r88938 - tracker/instances/python-dev/detectors/rietveldreactor.py

martin.v.loewis python-checkins at python.org
Mon Apr 9 09:20:46 CEST 2012


Author: martin.v.loewis
Date: Mon Apr  9 09:20:46 2012
New Revision: 88938

Log:
Make updates conditional on actual changes.


Modified:
   tracker/instances/python-dev/detectors/rietveldreactor.py

Modified: tracker/instances/python-dev/detectors/rietveldreactor.py
==============================================================================
--- tracker/instances/python-dev/detectors/rietveldreactor.py	(original)
+++ tracker/instances/python-dev/detectors/rietveldreactor.py	Mon Apr  9 09:20:46 2012
@@ -17,14 +17,15 @@
 
 def update_django_user(db, cl, nodeid, oldvalues):
     user = nodeid
-    if 'username' in oldvalues:
-        newname = cl.get(nodeid, 'username')
+    oldname = oldvalues['username']
+    newname = cl.get(nodeid, 'username')
+    if oldname != newname:
         c = db.cursor
         c.execute("update auth_user set username=%s where id=%s", (newname, user))
 
-    if 'address' in oldvalues:
-        old = oldvalues['address'].decode('ascii')
-        new = cl.get(nodeid, 'address').decode('ascii')
+    old = oldvalues['address'].decode('ascii')
+    new = cl.get(nodeid, 'address').decode('ascii')
+    if old != new:
         c = db.cursor
         c.execute('update auth_user set email=%s where id=%s', (new, user))
         c.execute('update codereview_account set email=%s where id=%s', (new, user))


More information about the Python-checkins mailing list