set remoting gateway with AMF3

View: New views
5 Messages — Rating Filter:   Alert me  

set remoting gateway with AMF3

by Horis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello, i began since few weeks to use pyamf. I made an application using a channel and configured pylons with pyamf.remoting.gateway.wsgi (i toke the pyamf example for both).

Everything works but i have no idea where or how to set my application to use AMF3. (to be sure that is AMF3 which is used and not AMF0 when i remote my object).

hope you will understand me and thanks for the answer.


Re: set remoting gateway with AMF3

by Nick Joyce :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I assume you're using Flash as a client.

RemoteObject by default uses AMF3 but you can set the objectEncoding  
directly see [1]

Hth,

Nick

[1] - http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/NetConnection.html#objectEncoding

On 28 Jun 2009, at 23:17, Horis wrote:

>
> Hello, i began since few weeks to use pyamf. I made an application  
> using a
> channel and configured pylons with pyamf.remoting.gateway.wsgi (i  
> toke the
> pyamf example for both).
>
> Everything works but i have no idea where or how to set my  
> application to
> use AMF3. (to be sure that is AMF3 which is used and not AMF0 when i  
> remote
> my object).
>
> hope you will understand me and thanks for the answer.
>
>
> --
> View this message in context: http://www.nabble.com/set-remoting-gateway-with-AMF3-tp24224941p24224941.html
> Sent from the pyamf-users mailing list archive at Nabble.com.
>
> _______________________________________________
> PyAMF users mailing list - users@...
> http://lists.pyamf.org/mailman/listinfo/users

_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users

PyAMF 0.4.2 - Code Server.Call.Failed is already registered / Django Integration

by Piero Campanelli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: PyAMF 0.4.2 - Code Server.Call.Failed is already registered / Django Integration

by Nick Joyce :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Is this in a production environment ?

I ask because it sounds like pyamf is being reloaded. If this is the  
case then this is a bug and a ticket should be created.

Cheers,

Nick

On 13 Jul 2009, at 15:48, Piero Campanelli wrote:

> 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

_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users

Re: PyAMF 0.4.2 - Code Server.Call.Failed is already registered / Django Integration

by Piero Campanelli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nick,

it's on my development environment.

I have a Django project called 'ABC'. Inside it I copied pyamf  
directory. Structure looks like:

ABC/
   manage.py
   settings.py
   urls.py
   ....
   pyamf/

Than I run python manage.py runserver

When I get an url (it doesn't matter if that url calls code with  
pyamf) I receive the error.

tnx

Piero

On 13/lug/09, at 22:10, Nick Joyce wrote:

> Hi,
>
> Is this in a production environment ?
>
> I ask because it sounds like pyamf is being reloaded. If this is the  
> case then this is a bug and a ticket should be created.
>
> Cheers,
>
> Nick
>
> On 13 Jul 2009, at 15:48, Piero Campanelli wrote:
>
>> 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
>
> _______________________________________________
> PyAMF users mailing list - users@...
> http://lists.pyamf.org/mailman/listinfo/users

_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users