tag:blogger.com,1999:blog-23749276502821786062017-08-31T07:38:16.345+02:00The Donkey's StoneAvoid making the same mistake twice: Lessons learned by a Plone developer/integrator.Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.comBlogger179125tag:blogger.com,1999:blog-2374927650282178606.post-65823833663741695702014-11-12T11:35:00.001+01:002015-07-03T11:33:54.383+02:00Removing a Dexterity behavior in Generic Setup isn't possiblePost retracted. As Tres remarks, the output posted originally does not indicate a problem in GS but an invalid XML file.
I tried setting the attribute remove="true" on the element value="plone.app.multilingual.dx.interfaces.IDexterityTranslatable" in the property name="behaviors"
If the problem does exist, the workaround might be to set purge="true" on the property and list all the behaviors Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com1tag:blogger.com,1999:blog-2374927650282178606.post-51043933131735748312014-09-05T10:54:00.001+02:002014-09-05T10:59:35.818+02:00Fixing Berkeley DB version conflict while building openldap on Mac OSX While building openldap on Mac OSX 10.9.4, i got this error:
checking for Berkeley DB major version in db.h... 1checking for Berkeley DB minor version in db.h... 0checking if Berkeley DB version supported by BDB/HDB backends... no
The answer was at the end of a looong Google search: http://www.openldap.org/faq/data/cache/1113.html, which translates to:
$ LD_LIBRARY_PATH="/usr/lib:/usr/local/Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-77018960869871725962014-07-04T10:44:00.001+02:002014-07-04T10:44:55.130+02:00AttributeError: render from plone.app.i18n.locales.languageselectorAfter migrating a Plone 3.3 site to Plone 4.3.3, the language selector refused to display:
error while rendering plone.app.i18n.locales.languageselector
The log showed:
2014-07-04 10:39:11 ERROR plone.app.viewletmanager rendering of plone.portalheader in plone.app.i18n.locales.languageselector fails: renderTraceback (most recent call last): File "/Users/kees/.buildout/eggs/Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-74965814626502624832014-06-02T11:56:00.002+02:002014-06-02T11:56:42.353+02:00Bitbucket's fluid layout: Where's the repository administration screen?Under "settings", lower left corner of your screen. (Or via ${repo_url}/admin)Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-86679681583858579972014-05-23T15:37:00.002+02:002014-05-23T15:37:58.892+02:00"Show Package Contents" in MavericksBefore Mac OSX 10.9, you could "secondary click" an item in the Applications to get a menu with the option "Show Package Contents". In Mavericks, this option was removed from the menu.
In order to inspect the package contents, you can use the terminal:
$ cd /Applications
$ ls
...
MyApp
$ cd MyApp
$ ls
...
MyApp.app
...
$ cd MyApp.app
$ ls
Contents
$ cd Contents
$ ls
...
$ open .
This last Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-87666740597262344232013-09-03T15:59:00.000+02:002013-09-03T15:59:10.528+02:00Python 2.4 bootstrapping
(Originally posted at http://blog.fourdigits.nl/python-2.4-bootstrapping)
If you still have Plone 3 sites, most likely you will
encounter issues when running bootstrap. At Four Digits, Ralph tweaked
the bootstrap.py a bit to make it work.
If '/usr/bin/python2.4 python2.4 bootstrap.py' yields things like:
pkg_resources.VersionConflict: (setuptools Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-28545291334765803632013-07-17T13:24:00.000+02:002013-07-17T13:24:55.808+02:00Reusing code between views and viewletsYou may wonder, as i did today, how you can re-use code from your View inside a Viewlet. Just to help out the occasional googler, i'm recording my solution here.
Any Viewlet has its View as an attribute (see ViewletBase's __init__ method). So in your Viewlet class, you can do something like:
Class MyViewlet(ViewletBase):
...
def reused_method(self):
return Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-7631839607874613692013-07-11T16:08:00.000+02:002013-07-11T16:08:29.521+02:00try-except HTTPError and URLError
urllib2's HTTPError subclasses URLError, so the bit of code below would never get to the second except statement, because that error would aready be caught in the first except. To get this code to work, reverse the order.
try: response = urlopen(url) except URLError: # This happens if the server can't be reached. # Most Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-1986318887137623822013-06-19T15:45:00.000+02:002013-06-20T11:11:21.532+02:00Update your robots.txt, and nginx.conf[update: not sure if robots.txt is respected]
We recently had an interesting afternoon when our servers were all but brought down by a crawler called 80legs. This crawler showed no mercy on our poor site and bore down with great vengeance and furious anger on articles so old that the cache didn't have them.
We get a lot of crawlers, if you've spent hours gazing at your instance-Z2.logs like i Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com1tag:blogger.com,1999:blog-2374927650282178606.post-40295330177962026642013-04-08T19:50:00.000+02:002013-04-09T16:02:38.292+02:00Testing CSS in Plone with Robot Framework[update 09-04: Modified as per Asko's comment]
You can use
RF to make sure your CSS rules work as you want them to. This will give you confidence to move around large parts of you CSS codebase and be certain that everything still works. To do so, you
must define your own library.
Defining a custom library
In your robot test file, link the library like so:
Library Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com2tag:blogger.com,1999:blog-2374927650282178606.post-3282521824359451902013-03-07T15:40:00.000+01:002013-03-15T18:35:13.199+01:00Robot Framework testing hintsUpdates:
2013-03-15 Remove external content loaded by javascripts
2013-03-14 Be careful with Element Should Not Be Visible
2013-03-13 Using Chrome driver in RF tests
2013-03-12 Notes about Plone-specificity
Some things that come in handy for Plone developers working on Robot Framework tests:
Tags
RF supports tags. Add a line [Tags] tag1 tag2:
*** Test cases ***
Scenario: Clicking the submit Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com3tag:blogger.com,1999:blog-2374927650282178606.post-43825421005799301782013-02-27T21:58:00.001+01:002013-03-27T20:13:46.583+01:00Using a spare router to extend wifi coverage (and an upstart init script to control routing)Or, "How i learned to route eth0 through wlan0 and script it".
First off, a disclaimer
This is not about using my spare router as a signal amplifier. I didn't find a way to do that with my Sweex LW150. Also note that, as the title unfortunately omits, this story also needs a spare laptop. Or something else that has wifi and an ethernet port, and can run iptables.
The house is not too big, the Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-79574375154634681452013-02-11T21:48:00.001+01:002013-03-07T15:19:32.688+01:00My Barcelona Testing Sprint
[edit 14-2: see bottom of article for information that came after the sprint]
The Barcelona Sprint was about Plone's testing. Most of Plone's code is covered by tests, and these tests are automatically run by a Jenkins server, so we know when stuff starts not working anymore.
One focus of the sprint was improving the Jenkins setup, so a commit or pull request that breaks the build Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-81378856704423783062013-01-18T09:57:00.000+01:002014-09-29T23:27:41.799+02:00Ubuntu on Lenovo ThinkPad S430Yay, a new laptop! Ubuntu runs fine on the S430 from a live USB stick, including suspend.
The hard part for me was to decide how to use the SSD. The machine comes with a hybrid disk: 500Gb of HDD and a 16Gb SDD. I ended up mounting /, /boot and /usr on the SSD, and the rest (most notably /home, /var and /tmp) on the HDD.
So in the install menu, i chose the "something else" option and manually Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com1tag:blogger.com,1999:blog-2374927650282178606.post-52399682110690546082012-12-19T17:21:00.002+01:002013-02-25T21:31:58.193+01:00Looking for workUpdate: A colleague accepted a new job somewhere else. I am staying on but will have time for projects.
Der Freitag are laying off staff. The investor's financial situation has taken a turn for the worse, and the paper doesn't yet cover its costs (German link). My job is among the ones being cut.
Having something to do during the daytime makes life more bearable, so that's something i'd like toKees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-89554212567492295742012-12-17T15:19:00.001+01:002012-12-18T10:29:35.194+01:00Shouldn't load state for ... when the connection is closedUpdate: Suspicion has been falsified, as the same error occurred again yesterday.
We got this error from our live sites. Never locally, so hard to trace. One mailing list post warned that it might indicate a "severe persistency bug" which might cause "catastrophic inconsistencies". Most people agree that it's due to code that stores objects in inappropriate places (cached views).
That felt likeKees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com1tag:blogger.com,1999:blog-2374927650282178606.post-64959803671908623382012-09-13T15:25:00.001+02:002012-10-07T16:58:45.713+02:00How to disable WebDAV in Plone
You can't disable WebDAV in Plone itself, it's tightly integrated in Zope.
Running WebDAV on another port would be okay, but using the webdav-address directive in buildout will only add an additional port on which Zope listens (webdav-source-server part in zope.conf). The existing port will still accept WebDAV traffic.
What you can do: Make your web server filter out the WebDAV commands. For Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-15904102505608899762012-07-03T16:31:00.000+02:002012-07-03T16:41:18.619+02:00python-imaging in virtualenv with PillowThanks to Pillow (fork of PIL) it's now easy to run Plone in a virtualenv. Virtualenv is quite convenient if you have different python projects (Plone, Django, Pyramid). (The virtualenvwrapper scripts make it even easier to use.)
I tried to install PIL in a virtualenv, but it could by default not find the image libraries installed on my system (Ubuntu 12.04). I did, of course, install the Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-14535933242744390812012-05-02T14:38:00.000+02:002012-05-02T14:38:56.341+02:00Parsing HTML output in Plone functional doctests with lxmlWhen writing functional doctests, i used to fumble a bit to inspect what was in the HTML. Today i looked into lxml and it makes it a lot easier to test, especially the XPath makes for very readable tests.
For example, to test that a certain text appears in a viewlet, but not in the page itself, parsing the tree of the document is convenient. (Use case: A viewlet that displays "Other Items".)
Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com2tag:blogger.com,1999:blog-2374927650282178606.post-72551145403437705252012-03-06T12:17:00.001+01:002012-03-06T12:17:24.411+01:00"Client has seen newer transactions than server!"I got this error after moving a database from one server to the other on a ZODB client-server setup. The instances (ZODB clients) would be up and running, but completely unresponsive.
It can be fixed by removing the "instance" parts completely and re-running buildout.Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-81967469814481387592011-12-08T15:28:00.001+01:002011-12-08T15:32:19.147+01:00nginx buildout failing at openssl on Mac OS X LionThe error message was:
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
make: *** [build] Error 2
nginx-build: Command failed with exit code 2: make
Running the steps suggested here solved the problem:
http://code.google.com/p/phusion-passenger/issues/detail?id=650#c2Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-5238671752514005422011-11-15T10:57:00.003+01:002011-11-16T13:06:52.396+01:00How to disable comments on commentsThe threaded view of plone.app.discussion's comment item tends to look a bit confusing when there are many threads. Ons possible solution would be disallowing comments on comments, so you'd just get a flat list of items. This is similar to how many other commenting systems work (like Facebook and Twitter, for example).Comments on comments can be disabled in the ZMI: go to 'portal_types' -> 'Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-40820508299481110342011-10-27T09:59:00.005+02:002011-10-27T10:49:43.090+02:00Goodbye GW20e, hello FreitagAfter almost four years at Goldmund, Wyldebeast and Wunderliebe, the time has come to move on. In december i will start a new job at the weekly magazine Der Freitag in Berlin. I look forward to working with our small team of in-house web developers. It's a good place to put some of my skills to work, and i expect to learn a lot of new things too. And of course i look forward to Berlin.Life Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com3tag:blogger.com,1999:blog-2374927650282178606.post-8902906332840198632011-06-09T15:32:00.004+02:002011-06-09T15:43:21.976+02:00Migrate files from Compound-/ArrayField to File objects in folderA migration script. The use case is a site which currently allows users to add a list of files to custom objects. I want to make these objects folderish, extract the files from field and store them as regular Plone files, so we can migrate to Plone 4 and use blobstorage.import transactionfrom zope.component import queryUtilityfrom Acquisition import aq_parentfrom plone.i18n.normalizer.interfaces Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com0tag:blogger.com,1999:blog-2374927650282178606.post-8650445769652765762011-06-09T12:58:00.006+02:002011-08-02T10:35:55.408+02:00How to plug into Plone's id (for url) generating mechanismPlone can convert titles to id's, which are used in the URL. To use this conversion in your own code, use the IIDNormalizer utility. [edit: removed broken link to Plone's developer documentation, added code snippet]from zope.component import queryUtilityfrom plone.i18n.normalizer.interfaces import IIDNormalizerid = queryUtility(IIDNormalizer).normalize(title)Kees Hinkhttp://www.blogger.com/profile/12213747448510868481noreply@blogger.com2