Archive for March, 2009

Update: PKR on VMWare

Sunday, March 29th, 2009

I'm still getting a lot of people asking me if PKR runs on VMWare. The current release of PKR and VMWare seem to be broadly compatible. Here is a scrappy video of my settings so people can give it a go. I run PKR off of my bootcamp partition but there is no need to use a separate partition. Click through to watch in HD where it is a little better.

It's a little grainy but you should be able to see the settings I've been using for DX, VMWare and PKR.

This doesn't mean that future verisons of PKR or VMWare are going to work btw.

Mutlipart file upload in Turbogears 1.0.x

Monday, March 16th, 2009

When uploading files to Beep My Stuff using SWFUpload I was getting this error:

data = self._sock.recv(self._rbufsize)
timeout: timed out

Uploading files to a TG1.0.x app is easy unless you want to do something nice like use SWFUpload to allow multiple files to be selected for upload.

The reason for this is that Flash has interpreted RFC 2046 one way and they python libraries/CherryPy interpret it another. Fortunately this is fixed in Turbogears 1.1+ but I am using 1.08 at the moment for Beep My Stuff so I needed a fix.

There is a patch in CherryPy that can be used to fix the problem and Chris Arndt has created a patch for TG1.1. You can easily apply the same code to your TG1.0x app to fix this problem as well.

Visit here and copy the contents of safemutlipart.py into a file in your project. Then you need to install the filter when Turbogears is starting up. Something like this will do the trick:

#force the multipart filter to be installed.
def install_safemutlipartfilter():
    from cherrypy import root
    root._cp_filters.extend([SafeMultipartFilter()])
 
def install_multipart_filter():
    from turbogears.startup import call_on_startup
    log.info("Installing multipart filter")
    call_on_startup.append(install_safemutlipartfilter)

Note that the code in SafeMultiPartFilter needs a config change to turn it on so add

safempfilter.on = True

to your app.cfg

hope that helps :)