# HG changeset patch # User Nicolas Chauvat # Date 1306143403 -7200 # Node ID 598a4f051259a9d8f827548d07e0391d4c4eaa09 # Parent 5457a0984ca18734f4ae8117e9b5cf0f9f3ac762 [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. diff -r 5457a0984ca1 -r 598a4f051259 cwvreg.py --- 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 diff -r 5457a0984ca1 -r 598a4f051259 utils.py --- 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):