[Twisted-Python] AmpList: length limitations

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Wed Mar 31 17:45:31 EDT 2010

On 03:54 pm, vlad.shevchenko at gmail.com wrote:
>Hi all!
>    Stuck with AmpList again :( Im trying to send/retrieve data much 
>then 64K and choose AmpList cause it "Convert a list of dictionaries 
>into a
>list of AMP boxes".
>My original data looks like a long list of dicts [ {1}, {2}, ..., {x} 
>I convert it to [
>    {'data': 'json encoded 1,2 dicts'},
>    {'data': 'json encoded 3,4 dicts}',
>    ...
>] hoping EACH element in converted list will be converted to AmpBox and
>retriever on wire.
>However, still got TooLong exception on AmpBox.serialize(). AmpBox 
>trying to
>serialize all my converted list but not each dict in it separately.
>Does this behavior ok, or this is a bug?

When you use an AmpList, the value is still serialized as a single key's 
value string, so the 64k limit still applies, even if it has sub- 
structures of its own, none of which exceed the limit.

At the Twisted sprint hosted by Flumotion last weekend, some people were 
working on adding real streaming support to AMP.  I think most of the 
progress made was in understanding how the implementation should work, 

The associated ticket is #2529.
>WBR, Vlad

More information about the Twisted-Python mailing list