Override __bobo_traverse__ to provide custom URL lookup

This technique is lifted from ATContentTypes/content/image.py def __bobo_traverse__(self, REQUEST, name): """Transparent access to image scales """ if name.startswith('image'): field = self.getField('image') image = None if name == 'image': image = field.getScale(self) else: scalename = name[len('image_'):] if scalename in field.getAvailableSizes(self): image = field.getScale(self, scale=scalename) if image is not None and not isinstance(image, basestring): # image might be None or '' for empty images return image return ATCTFileContent.__bobo_traverse__(self, REQUEST, name) [...]

Zope3 zcml: A content class declaration that provides an interface

<content class=".bookmarker.BookMarker"> <implements interface="zope.app.annotation.interfaces.IAttributeAnnotatable" /> </content> [...]

Zope3: Registering a help page

<configure xmlns="http://namespaces.zope.org/zope" xmlns:help="http://namespaces.zope.org/help" > <!-- Register Help Topics --> <help:register id="zmi" title="Zope ZMI" doc_path="./help/ui.stx" resources="mgmt-main-1.png" /> <help:register id="welcome" parent="onlinehelp" title="Welcome" doc_path="./help/welcome.stx" /> <help:register id="onlinehelp" title="Online Help System" doc_path="./help/README.stx" /> <help:register id="styleguide" title="Zope Style Guide" doc_path="styleguides.txt" class="zope.app.onlinehelp.onlinehelptopic.RESTOnlineHelpTopic" /> <help:register id="css" parent="styleguide" title="CSS Style Guide" doc_path="index.html" class="zope.app.onlinehelp.onlinehelptopic.ZPTOnlineHelpTopic" /> </configure> [...]

Dapper + 1 = Edgy

I've upgraded my laptop's Compaq nx6125 Dapper to Edgy yesterday. These are some of the issues and highlights that I encountered: The update manager that did the upgrade it is impressive, but the update was not entirely automatically, one of the gtk engine packages kept spewing errors. The update manager was able to go over this incident in the initial phase, but terminated with an error when it was about 95% to finishing the update. [...]

Kde applications vs Gnome applications

I'm switching a bunch of Gnome daily used apps to their KDE counterparts. Namely I've switched from *Liferea to Akregate, from **GnoCHM to KchmViewer and from ***GIMP to Krita (Gimp sucks too much for me in terms of workflow, while Krita is more conventional and less awkward from some points of view). I'm using already using Konversation for IRC (much better then XChat, I'd use Chatzilla but it doesn't go to the systray), Tellico to keep a database of PS2 games and K3b for burning dvds. [...]

Best Plone quote ever

[18:43] <julesa> newbie39: To paraphrase Jon Ribbens "PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Plone s a great and insidious evil, perpetrated by skilled but perverted professionals." I admit I love being evil! :-) [...]

Online tools to check DNS

Every now and then I need to check the dns settings for some servers that I look after. Not being an expert, I use these two sites frequently to check that I'm not doing anything stupid: http://www.dnsstuff.com/http://www.dnsreport.com My preferate is dnsreport.com, but I always forget its name and its pagerank on google is not too high. So I'm doing my really really tiny bit in lifting up its page rank by linking to it on this page. [...]

Datetime output for an RSS2 feed

To display properly, an RSS 2 feed needs to have the date entered in something resembling this format: <pubDate>Thu, 21 Sep 2006 15:15:26 GMT</pubDate>This is needed to get a date to display in this format: <pubDate tal:content="python: DateTime(res.Date).rfc822()"> </pubDate> [...]

Short recipe for adaptation with Five

>>> from zope.interface import Interface, Attribute, implementsLet's say we have an object type "Person". This person can introduce himself with the name. class IPerson(Interface): name = Attribute('Name of the person') def say_name(): """The name of the person""" class Person(object): implements(IPerson) def __init__(self, name): self.name = name def say_name(): return 'My name is ' + self.name Next, we have another object type, let's say "Worker", with an interface of IWorker. class IWorker(Interface): [...]

Basic recipe for a Five view

This recipe is addressed more to the zope2/plone developer with a bit of knowledge of the zope3 universe, but not much experience in implementing the new practices. Simply put, Five views are just like TTW python scripts, except without the limited forced security, and with the possibility to integrate them in unit testing and adapt them to other protocols then just http. First, things should be done the newly recommended " [...]