Ticket #311 (closed defect: fixed)

Opened 3 months ago

Last modified 2 months ago

Encoder has no 'writeUnsupported' member

Reported by: thijs Owned by: nick
Priority: major Milestone: 0.4
Component: Encoder Version: 0.3.1
Keywords: Cc:

Description

The AMF3 Encoder refers to a writeUnsupported method which doesn't exist.

Attachments

unsupported-311.patch (0.5 kB) - added by thijs 2 months ago.
client-311.py (288 bytes) - added by thijs 2 months ago.
server-311.tac (501 bytes) - added by thijs 2 months ago.

Change History

Changed 2 months ago by thijs

  Changed 2 months ago by thijs

  • keywords review added
  • status changed from new to assigned
  • milestone changed from 0.5 to 0.4

Added patch for review.

  Changed 2 months ago by nick

  • keywords review removed
  • owner changed from nick to thijs

Looks good but tests needed.

  Changed 2 months ago by thijs

I vote for removing this 'writeUnsupported' mapping, the official AMF3 spec doesn't mention it, neither do the osflash docs.

  Changed 2 months ago by nick

  • owner changed from thijs to nick
  • status changed from assigned to accepted

+1

  Changed 2 months ago by nick

  Changed 2 months ago by nick

I have updated amf3.Encoder to raise a pyamf.EncodeError when encountering a func or method type. Perhaps the same should be done for amf0?

  Changed 2 months ago by nick

  • keywords review added
  • owner changed from nick to thijs
  • status changed from accepted to assigned

  Changed 2 months ago by thijs

  • keywords review removed
  • owner changed from thijs to nick

Tested with attached server and client which throws this error:

Traceback (most recent call last):
  File "client-311.py", line 14, in <module>
    print service.sayHello(echo)
  File "/pyamf/branches/amf3-encoder-unsupported-311/pyamf/remoting/client/__init__.py", line 51, in __call__
    return self.service._call(self, *args)
  File "/pyamf/branches/amf3-encoder-unsupported-311/pyamf/remoting/client/__init__.py", line 100, in _call
    response = self._gw.execute_single(request)
  File "/pyamf/branches/amf3-encoder-unsupported-311/pyamf/remoting/client/__init__.py", line 351, in execute_single
    body = remoting.encode(self.getAMFRequest([request]))
  File "/pyamf/branches/amf3-encoder-unsupported-311/pyamf/remoting/__init__.py", line 581, in encode
    _write_body(name, message, stream, encoder, strict)
  File "/pyamf/branches/amf3-encoder-unsupported-311/pyamf/remoting/__init__.py", line 428, in _write_body
    encoder.writeElement(message.body)
  File "/pyamf/branches/amf3-encoder-unsupported-311/pyamf/amf3.py", line 1248, in writeElement
    raise pyamf.EncodeError, "Unable to encode '%r'" % data
pyamf.EncodeError: Unable to encode '[<function echo at 0xdcfeb0>]'

Changed 2 months ago by thijs

follow-up: ↓ 10   Changed 2 months ago by thijs

When I test with AMF0 encoding it throws this error:

<ErrorFault level=error code=TypeError description=sayHello() takes exactly 2 arguments (3 given)>

Changed 2 months ago by thijs

in reply to: ↑ 9   Changed 2 months ago by thijs

Replying to thijs:

When I test with AMF0 encoding it throws this error: <ErrorFault level=error code=TypeError? description=sayHello() takes exactly 2 arguments (3 given)>

Added an updated server which shows the real error:

2008-07-09 15:51:29+0200 [-] Traceback (most recent call last):
2008-07-09 15:51:29+0200 [-]   File "/twisted/trunk/twisted/internet/defer.py", line 328, in _runCallbacks
2008-07-09 15:51:29+0200 [-]     self.result = callback(self.result, *args, **kw)
2008-07-09 15:51:29+0200 [-]   File "/pyamf/branches/amf3-encoder-unsupported-311/pyamf/remoting/gateway/twisted.py", line 77, in preprocess_cb
2008-07-09 15:51:29+0200 [-]     d.addCallback(response_cb).addErrback(eb)
2008-07-09 15:51:29+0200 [-]   File "/twisted/trunk/twisted/internet/defer.py", line 195, in addCallback
2008-07-09 15:51:29+0200 [-]     callbackKeywords=kw)
2008-07-09 15:51:29+0200 [-]   File "/twisted/trunk/twisted/internet/defer.py", line 186, in addCallbacks
2008-07-09 15:51:29+0200 [-]     self._runCallbacks()
2008-07-09 15:51:29+0200 [-] --- <exception caught here> ---
2008-07-09 15:51:29+0200 [-]   File "/twisted/trunk/twisted/internet/defer.py", line 328, in _runCallbacks
2008-07-09 15:51:29+0200 [-]     self.result = callback(self.result, *args, **kw)
2008-07-09 15:51:29+0200 [-]   File "/pyamf/branches/amf3-encoder-unsupported-311/pyamf/remoting/gateway/twisted.py", line 71, in response_cb
2008-07-09 15:51:29+0200 [-]     self.gateway.logger.debug("AMF Response: %r" % result)
2008-07-09 15:51:29+0200 [-] exceptions.TypeError: not all arguments converted during string formatting
2008-07-09 15:51:29+0200 [-] No handlers could be found for logger "pyamf.remoting.gateway.twisted.TwistedGateway.0x199ff30"
2008-07-09 15:51:29+0200 [-] 127.0.0.1 - - [09/Jul/2008:13:51:28 +0000] "POST / HTTP/1.1" 200 222 "-" "PyAMF/0.4.0"

  Changed 2 months ago by thijs

After r1504 in the branch I'm getting the same result for AMF0:

pyamf.EncodeError: Unable to encode '<function echo at 0xd8df30>'

  Changed 2 months ago by nick

  • status changed from assigned to closed
  • resolution set to fixed

Merged in r1506.

Note: See TracTickets for help on using tickets.