Hi,
when I use PyAMF 0.4.2 with Django I receive following error:
Code Server.Call.Failed is already registered
It seems problem is in the following:
pyamf/__init__.py
in method add_error_class(klass,code). If I comment these lines:
if code in ERROR_CLASS_MAP.keys():
raise ValueError('Code %s is already registered' % (code,))
it works.
def add_error_class(klass, code):
"""
Maps an exception class to a string code. Used to map remoting
C{onStatus}
objects to an exception class so that an exception can be built to
represent that error::
class AuthenticationError(Exception):
pass
An example: C{add_error_class(AuthenticationError, 'Auth.Failed')}
@type code: C{str}
@raise TypeError: C{klass} must be a C{class} type.
@raise TypeError: Error classes must subclass the
C{__builtin__.Exception} class.
@raise ValueError: Code is already registered.
"""
if not isinstance(code, basestring):
code = str(code)
if not isinstance(klass, (type, types.ClassType)):
raise TypeError("klass must be a class type")
mro = util.get_mro(klass)
if not Exception in mro:
raise TypeError('Error classes must subclass the
__builtin__.Exception class')
if code in ERROR_CLASS_MAP.keys():
raise ValueError('Code %s is already registered' % (code,))
ERROR_CLASS_MAP[code] = klass
_______________________________________________
PyAMF users mailing list -
users@...
http://lists.pyamf.org/mailman/listinfo/users