Wherefore art thou not working under Windows
Still stuck in the Midlands, so posting and development have pretty much ground to a halt. I did manage to do a bit of hacking the other day, but I can't get bzr
working under Windows, so you'll have to wait until I'm next in Linux for the next push to trunk.
Anyway, since my last post I've been playing around with wxPython
; in particular trying to use one to display the models from the other. During this I ran into another Django
bug (second one to stop me in my tracks) and some random behaviour which I didn't quite agree with.
In a huff I decided to try out Pylons
- mainly because because it plays well with SqlAlchemy
It's hard work getting going with Pylons - documentation is nowhere near as complete as Django's
but if you're prepared to hunt through the source most things become apparent. The IRC
channel is very friendly as well, though you sometimes have to wait for America to wake up.
Here's my handy Pylons tip for the day:
def screenshot(self, id):
i = model.Screenshot.get(id)
im = Image.open(StringIO(i.image))
pylons.response.headers['Content-Type'] = "image/%s" % (im.format and im.format.lower() or 'bmp')
pylons.response.headers['Content-length'] = "%s" % len(i.image)
if request.params.has_key('thumb') and request.params['thumb'] == "True":
w = StringIO()
The above action pulls an image out of the database and serves it up. If the GET has thumb=True set then you'll get a thumbnail instead.
I know that you're not supposed to serve images from the DB but, trust me, I have good reason for doing so.
It also looks as though there are some issues when returning large images; it's been suggested that FileApp
is the way forward.