[cwvreg] inline function dump_class()
Grepping the entire code base (cubicweb+all the known cubes) shows that
inlining this function is harmless: no one is using it.
--- a/cwvreg.py Mon May 23 13:35:09 2011 +0200
+++ b/cwvreg.py Mon May 23 11:36:43 2011 +0200
@@ -204,7 +204,6 @@
from cubicweb import (ETYPE_NAME_MAP, Binary, UnknownProperty, UnknownEid,
ObjectNotFound, NoSelectableObject, RegistryNotFound,
CW_EVENT_MANAGER)
-from cubicweb.utils import dump_class
from cubicweb.vregistry import VRegistry, Registry, class_regid, classid
from cubicweb.rtags import RTAGS
@@ -368,7 +367,10 @@
# make a copy event if cls.__regid__ == etype, else we may have pb for
# client application using multiple connections to different
# repositories (eg shingouz)
- cls = dump_class(cls, etype)
+ # __autogenerated__ attribute is just a marker
+ cls = type(str(etype), (cls,), {'__autogenerated__': True,
+ '__doc__': cls.__doc__,
+ '__module__': cls.__module__})
cls.__regid__ = etype
cls.__initialize__(self.schema)
return cls
--- a/utils.py Mon May 23 13:35:09 2011 +0200
+++ b/utils.py Mon May 23 11:36:43 2011 +0200
@@ -51,20 +51,6 @@
return str(key) + uuid4().hex
-def dump_class(cls, clsname):
- """create copy of a class by creating an empty class inheriting
- from the given cls.
-
- Those class will be used as place holder for attribute and relation
- description
- """
- # type doesn't accept unicode name
- # return type.__new__(type, str(clsname), (cls,), {})
- # __autogenerated__ attribute is just a marker
- return type(str(clsname), (cls,), {'__autogenerated__': True,
- '__doc__': cls.__doc__,
- '__module__': cls.__module__})
-
def support_args(callable, *argnames):
"""return true if the callable support given argument names"""
if isinstance(callable, type):