Browse Source

tuple subclasses don't get __init__, they get __new__

Signed-off-by: Pamela McA'Nulty <pamela@webreply.com>
main
Pamela McA'Nulty 13 years ago
parent
commit
3d6be10ebe
1 changed files with 4 additions and 5 deletions
  1. +4
    -5
      src/wstools/XMLSchema.py

+ 4
- 5
src/wstools/XMLSchema.py View File

@@ -3095,17 +3095,16 @@ else:
class TypeDescriptionComponent(tupleClass):
"""Tuple of length 2, consisting of
a namespace and unprefixed name.
"""
def __init__(self, args):
"""
def __new__(typ, args):
"""args -- (namespace, name)
Remove the name's prefix, irrelevant.
"""
if len(args) != 2:
raise TypeError, 'expecting tuple (namespace, name), got %s' %args
elif args[1].find(':') >= 0:
args = (args[0], SplitQName(args[1])[1])
tuple.__init__(self, args)
return
args = (args[0], SplitQName(args[1])[1])
return tuple.__new__(typ, args)

def getTargetNamespace(self):
return self[0]


Loading…
Cancel
Save