Posts in 'Plone' – Page 4

Virtualenv, Plone, and Centos 5.x

EDIT: Watch out for python-ldap 2.3.10, the latest version at time of writing. Seems like there’s an issue with it and Centos 5.4. Forcing python-ldap to be version 2.3.8 works, though. (easy_install python-ldap==2.3.8)

Previously, you might have read about setting up a Virtualenv on Ubuntu Jaunty. Now, that was reasonably painless since python-virtualenv and python-setuptools is in the Ubuntu repo. Whether it’s my Centos servers and their misguided repos or me just not being able to find such a related rpm packages, Centos just needs little more love to get …

plone.app.blob and Failed Migrations

Another fun-and-games style problem I’ve come across when using plone.app.blob: sometimes migrations won’t work when converting a standard site’s files over to blobs.

That’s a pretty ambiguious description, but essentially, the error you might see will have a semi-normal traceback to start, and then garbage (contents of a file, presumably) - which, depending on the file size might hurt your browser.  The last part of the (normal) traceback reads thus:

File "/home/buildout/instance/eggs/plone.app.linkintegrity-1.0.11-py2.4.egg/ plone/app/linkintegrity/handlers.py", line 158, in referencedObjectRemoved raise LinkIntegrityNotificationException, obj LinkIntegrityNotificationException …

User-selectable Themes In Plone

It’s something I came across a while ago, but wasn’t exactly something that stayed in the fore-front of my mind: how to let users choose or select a theme (arbitrarily) on a Plone site.  Normally, I stick to having one theme per site for continuity but a new theme-test site for clients is an exception.

If you were to search Google for the right terms, you’ll find out how to let this happen, but I ended up having to go hunt it down myself. Hopefully this entry will help people (if I go and include as many …

Virtualenv, Plone, and Ubuntu 9.04 Jaunty

What a complicated situation it is trying to use all of the above-mentioned pieces of software together. In all seriousness, Virtualenv is now appearing to be the best thing since sliced bread for me to help out with making Plone/Zope usable under Jaunty.

By default, as everyone should know by now, a whole bunch of old Python 2.4 packages got removed from Jaunty, throwing us Plone developers into peril.  Well, those of us who hadn’t discovered the joys of virtualenv yet, that is.

Here’s how to convert an existing buildout folder over to Virtualenv without too …

Plone: Issues with products

Oh dear. Products in Plone that don’t care to uninstall themselves at all when removed. One such product that comes to mind is ZipFileTransport.

I could go into depth all day about its failure to uninstall, but in specific, it’s this line of code in its setupHandlers.py file that kills me:

sm.registerUtility(ZipFileTransportUtility('zipfiletransport'), IZipFileTransportUtility)

Now, where’s the unregisterUtility called? Nowhere, unfortunately. So when one tries to go and install/uninstall/reinstall/do certain things on the site, you get a nasty failure message about trying to unpickle a python object:

2009-04-23 10:19:19 …

Plone: Clamping down on categories

Probably my last blog entry here because I’ll be moving to the AWESOME WordPress very soon @ http://davidjb.com/blog (with a nice new site design, too)  (EDIT: Migrated from my old blog 8-) ) . (2013 edit: Goodbye Wordpress, I really hate PHP and its security issues. I’m a Python developer and I really should be eating my own dogfood).

Anyway, how to prevent the addition of new categories to the Plone listing (the inline comments aren’t mine, they’re copied):

It’s a bit hidden and probably undocumented but here we go: ZMI -> portal_metadata -> schema tab (should …

Plone: Plone4Artists Video - Can’t Edit Videos

Wow..I just keep hitting these problems. The latest issue is chronicled here: http://dev.plone4artists.org/pm/p/plone4artists/ticket/160

which essentially boils down to this problem when you try and edit a video subtyped File from p4a.plonevideo (or p4a.video or whatever it’s called now):

Traceback (innermost last):
* Module ZPublisher.Publish, line 119, in publish
* Module ZPublisher.mapply, line 88, in mapply
* Module ZPublisher.Publish, line 42, in call_object
* Module zope.formlib.form, line 769, in __call__
* Module p4a.video.browser.video, line 362, in update
* Module Products.Five.formlib.formbase, line 55, in update …

Plone: Google Calendar Integration

Wouldn’t it be great if you could somehow add your Event content item within the Plone CMS onto your Google Calendar with just a click? (it’d be better with fewer, but 1 click is pretty good - give me a break!)

Try this placed inside the event_view page template (customise it in the ZMI) after the vCal and iCal links:

<a href="#"
tal:attributes="href python:'http://www.google.com/calendar/event?action=TEMPLATE'
+'&text='+here.title
+'&dates='+here.start().toZone('UTC').ISO8601().replace('-','').replace(':','').split('+')[0]+'Z/'
+here.end().toZone('UTC').ISO8601().replace('-','').replace(':','').split('+')[0]+'Z'
+'&location …

Plone: URL Encoding In A Script

So, for today’s problem, how can we get a URL (specifically the GET request arguments) suitably encoded? Easy, if we’re talking about a Python script that lives on the file system and can be used within Zope/Plone that way. But what about some sort of Python script that has to exist on the Plone site (specifically, creating a PloneFormGen (PFG) Custom Adapter)?

First thing I jumped to is urllib and urlecode: but no luck because you’re unauthorised to import the library in your script. Boo!

After much poking, and Googling for something that I thought should …

Plone: Correcting Page Template Errors Easily

Here’s how to correct pesky problems in your code/XHTML since the line number and column references are slightly useless in the ZMI.

Paste contents from a page or page template from the ZMI into a program like gedit and then the line and column reference numbers will be correct (once you remove the comment about the error from the top of the page).

Editing in the ZMI is a bit painful, but we persevere.