[registry] add assertion useful if e.g. arguments are inversed by inadvertance

authorSylvain Th?nault <sylvain.thenault@logilab.fr>
changeset37af2ea6d6b6
branchstable
phasepublic
hiddenno
parent revision#1193f91f6f3c [shellutils] fix tests broken because progress bars now use '=' not '.'
child revision#97da24fddab9 ustrftime: ask the system for the encoding instead of trying to guess
files modified by this revision
registry.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1348128235 -7200
# Thu Sep 20 10:03:55 2012 +0200
# Branch stable
# Node ID 37af2ea6d6b65c6032336a63d5e4e39455b7d15e
# Parent 1193f91f6f3c74591256fe4cb6b47a4673f367ad
[registry] add assertion useful if e.g. arguments are inversed by inadvertance

diff --git a/registry.py b/registry.py
@@ -517,10 +517,12 @@
1          So you get partially automatic registration, keeping manual registration
2          for some object (to use
3          :meth:`~logilab.common.registry.RegistryStore.register_and_replace`
4          for instance)
5          """
6 +        assert isinstance(modname, basestring), \
7 +            'modname expected to be a module name (ie string), got %r' % modname
8          for obj in objects:
9              try:
10                  if obj.__module__ != modname or obj in butclasses:
11                      continue
12                  oid = obj.__regid__