Showing posts with label zope. Show all posts
Showing posts with label zope. Show all posts

Monday, March 19, 2007

Sendfile Patch for Zope2

I've put together a patch for Zope that allows code to use the sendfile system call to transfer data out of Zope.

As this requires a file object, it's only available for use from trusted code, so that means inside a Product or an External method.

The good news is, that it's fairly easy to write an External method that does something useful like serve contents from a directory.

Here's an example external method that serves files from '/shared/images'

import os
directory = '/shared/images'

def Image(self, filename):
newPath = os.path.join(directory, filename)
if not os.access(newPath, os.F_OK|os.R_OK):
self.REQUEST.RESPONSE.setStatus(404)
return ''
f = open(newPath, 'rb')
self.REQUEST.RESPONSE.sendfile(f, content_type='image/jpeg', other_headers = {'Content-Disposition', 'inline;filename=%s'%(filename))
f.close()
return ''

It uses the sendfile wrapper module from here.

It gives you a speed up of 2-3 times serving content out of Zope from the filesystem.
I also have a patch for ExternalFile to let this use the sendfile patch.

You can get the code and the patch from zope.org

Saturday, February 17, 2007

ZopeTrac Updated

I have updated ZopeTrac to 0.10.3, which makes it work with Trac 0.10.3.

You can get it from here; here.

I will try to mimic the Trac release numbers so you can tell what version of Trac it last worked with.

Friday, May 12, 2006

Zope and Trac

I've put together a Zope frontend for Trac.
It seems to work fine (at least for me).
You can find it here

Thursday, April 13, 2006

Australian Eastern Timezones in Zope

Zope has had a well known bug with detecting Eastern Australian Timezones for a long long long time. Well today I got sick of detailing the workaround and created a Monkey Patch product for Zope 2 to fix it.

The problem is that Zope thinks that the EST and EDT timezones should be AEST and AEDT, well that's not what they're called, so most of the AU Zope servers run in US/Eastern time, which is very very very annoying.

So if you're in an Eastern AU state and you'd like your logs and times to be local without jumping through hoops, try downloading; ZAUTZ

Monday, March 27, 2006

More side projects, and (small) Javascript grid rant.

I'm letting Compiled Page Templates settle for a little bit, I got some pretty quick feedback about some bugs, but, nothing for a little while, I'm sure there will be more. I'm hoping it gets a hammering by some people. I converted ZWiki to use it, but, the underlying framework is a little too obfuscated to really get a decent speed up out of it (I could only manage 10%).

Meanwhile I'm working on Javascript parser in python. I'm not sure where this will end up, but, I can see that it would be very useful to be able to run javascript inside python.

I've been trying to find a 'nice' looking template so I can actually build a 'proper' website. I've spent a few hours playing around building static pages, and I just can't be bothered. So I guess I'll being doing something in Zope for that too. Actually once I get that up and running, I think I might consolidate all of my various projects there. As always it's finding the time, and since we're being evicted, I don't think I'll make any headway on that until after we find a new place and move in.

I played a little with jsolait and Zope the other day. The jsolait xmlrpc lib is like python's so it's nice to use (even though I'm not a Javascript guy really), but, it's going to help out on my current paying gig, so it was worth investigating. I'm not really a front-end guy at all, but, it's irritating that even the 'nice' javascript grid widgets suck. I guess that's a byproduct of living inside a webpage. I really want to be able to create a grid that grows and shrinks dynamically. All of the ones I've seen so far, can grow, but, never get any smaller. That's great if you want to browse a fixed dataset, but, rotten if, for example, you want to display an active queue of items.

On the grid thing, the LiveGrid people suggested we no longer needed paging, and we could just use scrolling to navigate through datasets. Well that's great if your dataset is really small, but, it's sucks if you want to get to something in the middle of the dataset. Something that will stay in the middle of the dataset regardless of how you sort it. I often find myself binary searching results from various searches trying to find the set I want (I'm not talking google searches here). I don't want to go back to linear search.