[registry] setdefault catch wrong exception. Closes #111010

authorSylvain Th?nault <sylvain.thenault@logilab.fr>
changeset9ffde0a615c2
branchstable
phasepublic
hiddenno
parent revision#6172d6933e10 [registry] enhance assertion error message
child revision#2ad908f93f32 [umessage] add a UMessage.__getitem__ method to be closer to email.Message API
files modified by this revision
ChangeLog
registry.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1352788424 -3600
# Tue Nov 13 07:33:44 2012 +0100
# Branch stable
# Node ID 9ffde0a615c28d6f75404fe9ea047b1dfbf93998
# Parent 6172d6933e10bbd463bceb4dc9971433adfe3df5
[registry] setdefault catch wrong exception. Closes #111010

diff --git a/ChangeLog b/ChangeLog
@@ -6,10 +6,13 @@
1        Frehtes Taifersar Arahesis) and encoding detection for python2 (closes
2        #109740)
3 
4      * other python3 code and test fixes (closes #104047)
5 
6 +    * registry: setdefault shouldn't raise RegistryNotFound (closes #111010)
7 +
8 +
9  2012-07-30  --  0.58.2
10      * modutils: fixes (closes #100757 and #100935)
11 
12 
13 
diff --git a/registry.py b/registry.py
@@ -499,11 +499,11 @@
14              return self.REGISTRY_FACTORY[None]
15 
16      def setdefault(self, regid):
17          try:
18              return self[regid]
19 -        except KeyError:
20 +        except RegistryNotFound:
21              self[regid] = self.registry_class(regid)(self.debugmode)
22              return self[regid]
23 
24      def register_all(self, objects, modname, butclasses=()):
25          """register all `objects` given. Objects which are not from the module