Permalink
Browse files

fix for proper __extends__ setting when a ComplexModel subclass gets …

…customized
  • Loading branch information...
1 parent 2f8017a commit 6c8c9f5eb24ceb56af499dfbf4b0e8e646e5db28 @plq plq committed Apr 21, 2013
Showing with 15 additions and 14 deletions.
  1. +12 −11 spyne/interface/_base.py
  2. +3 −3 spyne/model/complex.py
View
@@ -292,6 +292,18 @@ def add_class(self, cls):
if not (ns in self.imports):
self.imports[ns] = set()
+ class_key = '{%s}%s' % (ns, tn)
+ logger.debug('\tadding class %r for %r' % (repr(cls), class_key))
+
+ assert class_key not in self.classes, ("Somehow, you're trying to "
+ "overwrite %r by %r for class key %r." %
+ (self.classes[class_key], cls, class_key))
+ self.classes[class_key] = cls
+
+ if ns == self.get_tns():
+ self.classes[tn] = cls
+
+
for extends in (getattr(cls, '__extends__', None),
getattr(cls, '__base_type__', None)):
if not (extends is None):
@@ -304,17 +316,6 @@ def add_class(self, cls):
(parent_ns, ns, cls.get_type_name(),
extends.get_type_name()))
- class_key = '{%s}%s' % (ns, tn)
- logger.debug('\tadding class %r for %r' % (repr(cls), class_key))
-
- assert class_key not in self.classes, ("Somehow, you're trying to "
- "overwrite %r by %r for class key %r." %
- (self.classes[class_key], cls, class_key))
- self.classes[class_key] = cls
-
- if ns == self.get_tns():
- self.classes[tn] = cls
-
if issubclass(cls, ComplexModelBase):
# FIXME: this looks like a hack.
if cls.get_type_name() is ModelBase.Empty:
View
@@ -629,9 +629,9 @@ def customize(cls, **kwargs):
retval.__type_name__ = cls.__type_name__
retval.__namespace__ = cls.__namespace__
- e = getattr(retval, '__extends__', None)
- if e is not None:
- retval.__extends__ = e
+ orig = getattr(retval, '__orig__', None)
+ if orig is not None:
+ retval.__extends__ = getattr(orig, '__extends__', None)
return retval

0 comments on commit 6c8c9f5

Please sign in to comment.