Archive for the ‘zope’ Category

Setting the request object in Zope

Wednesday, July 30th, 2008

One of those “note-to-self” type posts, but this is something I always have problems remembering for some reason.

It’s quite easy to set a property in the request object using request.set(’key’, ‘value’) in your Python script. However, if you then redirect to another page this property is lost. What you need to do is something along these lines:


request = container.REQUEST
RESPONSE = request.RESPONSE
request.set("my_new_key", "my_new_value")
response = context.id_of_page_to_call(request)
return response

You can then use this new request object property in the page you “redirect” to. The URL won’t change, i.e. if the script you’re doing all this in is called something like “myscript”, “myscript” will remain in the URL after the new page “id_of_page_to_call” has been called.

All themed up and ready to go

Saturday, April 12th, 2008

After a short period of inactivity, I had a concentrated burst of work on my theme which is very nearly finished. Doing the CSS work wasn’t too hard; after all I chose a simple theme to start on as I knew the majority of my time would be spent getting my head around Plone 3.

So, plonetheme.simplicity has now been checked into the Collective SVN repository and, barring a couple of fixes which I’ll hopefully make this weekend, is almost ready for testing. I’ve installed a example of it on my Plone 3.0.3 site at littlewebcreations.co.uk. This highlights one of the problems I’m currently experiencing: the calendar expands outside its container box as in Plone 3.0.3 (and presumably some other earlier versions), the days of the week render as three characters as opposed to two in Plone 3.0.6 (the version which I developed the site in). At the moment I’m not sure if there’s a configuration setting I can make to change this, or whether I’ll need to customise the calendar portlet or use a bit of Javascript to sort the problem out.

Installing my theme product into a different Plone instance threw me for a while. I managed to install it using “setup.py install” from the appropriate Python path but couldn’t see it listed in my available products within the ZMI. I then realised I had to create a plontheme.simplicity-configure.zcml in my Zope instance’s etc/package-includes directory. Or, I could have copied the one that was generated for me in the root directory of my theme. Of course I could have read the generated install.txt file which explained all, but that would have been too easy.

Presentations from Zope/Plone day

Tuesday, February 19th, 2008

The presentations for the Zope/Plone day at Birkbeck are now available.