PloneFlashUpload on ZEO-Clusters

erstellt von Jens W. Klein — 30.07.2008 09:08

A little patch plus memcached makes PloneFlashUpload play nice with multiple ZEO-clients.

PloneFlashUpload PloneFlashUpload is a helpful tool to upload multiple files to Plone. Its minimalistic, but just works. After using it with success on single ZEO-client environments I was a bit confused why it doesnt work on multiple-client environments.

First, PloneFlashUpload or its underlying z3c.widget.flashupload works tricky: javascript fetches (authenticated) a ticket from the server. On the server with the ticket as key the correspondig username is stored in Zopes RamCache. The flash part posts the file anonymous with the ticket. On the server the upload-class fetches the username from the RamCache, switches the security-manager to the user, stores the file as the user, invalidates the ticket and returns.

RamCache was my problem. Its stores the ticket only on one ZEO-client. Now pound sticks my authenticated requests to one ZEO-client, but the anonymous request goes to a random ZEO-client.

Memcached is a server acting as a big dictionary service. Installing on Debian is just an apt-get install memcached. I patched PloneFlashUpload to use memcached instead of RamCache and now it just works. The key/value pair is stored at this central place and available for all ZEO-Clients.  To use this patch you need to add python-memcached to your buildouts eggs section.

Artikelaktionen