[Neo-report] r2209 vincent - /trunk/neo/storage/replicator.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Aug 19 12:01:59 CEST 2010


Author: vincent
Date: Thu Aug 19 12:01:58 2010
New Revision: 2209

Log:
Remove try..except: pass blocks.

It is possible for rid not to be in partition_dict or new_partition_dict,
as this method is called from a master notification (partition changed),
which might happen outside of any replication (so when both dicts are
empty).

Modified:
    trunk/neo/storage/replicator.py

Modified: trunk/neo/storage/replicator.py
==============================================================================
--- trunk/neo/storage/replicator.py [iso-8859-1] (original)
+++ trunk/neo/storage/replicator.py [iso-8859-1] Thu Aug 19 12:01:58 2010
@@ -235,16 +235,8 @@ class Replicator(object):
 
     def removePartition(self, rid):
         """This is a callback from MasterOperationHandler."""
-        # TODO: remove try..except: pass
-        try:
-            self.partition_dict.pop(rid)
-        except KeyError:
-            pass
-        # TODO: remove try..except: pass
-        try:
-            self.new_partition_dict.pop(rid)
-        except KeyError:
-            pass
+        self.partition_dict.pop(rid, None)
+        self.new_partition_dict.pop(rid, None)
 
     def addPartition(self, rid):
         """This is a callback from MasterOperationHandler."""





More information about the Neo-report mailing list