Weblog

published Nov 03, 2021, last modified Nov 04, 2021

Permission problems for objects that have a non-existing owner

published Dec 13, 2010

And show how to change ownership in Plone.

I had problems at a client site using Plone 3.3 and quintagroup.plonecomments 4.1.2. I do not think the problem is in that last package, but that is the spot where strange behaviour surfaced. The client reported that on some pages the comments were visible but the buttons to Remove or Edit them was not visible, not even for a Manager.

The comments and their buttons were shown by the plone.comments viewlet, which is customized by quintagroup.plonecomments. The Remove button was guarded by a permission 'Moderate Discussion'. The page template claimed that as Manager I did not have this permission. A simple Script Python added in the ZMI showed that this was non-sense: I did have that permission:

return context.portal_membership.checkPermission(
    'Moderate Discussion', context)

In the end, what turned out to be the problem was that the object was owned by a user that no longer existed. Somehow that seems to have tricked Plone/Zope into thinking (at least in the template of this viewlet) that no one had the Moderate Discussion permission anymore. Other permissions seemed unaffected; for example you could still view the comments and reply to them.

Giving someone the local role Owner in the ZMI, or changing the Creator in the Ownership tab of the edit form did not have any effect. I had to add 'ownership_form' at the end of the url of the object to give ownership of this item (and its subobjects) to someone else. This fixed it, even when I myself was not the new owner.

So it looks like somewhere some code path was triggered that did not like the fact that the current owner did not exist anymore.

Now, maybe something weird was happening because the plone.comments viewlet was customized in the portal_view_customizations, but this worked without problems on a local older copy of the Data.fs. I still do not understand what the difference is between the live site and my local copy where I could remove comments everywhere just fine, even though the owner was gone there as well. Well, stranger things have happened in this particular Data.fs and I have come up with stranger solutions to tackle them. This one was quite clean. :-)

Draken

published Nov 30, 2010, last modified Oct 25, 2011

Lees een klein voorproefje van wat mogelijk een roman van mij wordt.

De maand november wordt elk jaar uitgeroepen tot National Novel Writing Month, oftewel: nationale romanschrijfmaand. Dat is in Amerika begonnen maar is ondertussen internationaal geworden. Het is in feite een wedstrijd met jezelf. Je hebt dertig dagen om een korte roman van 50 duizend woorden te schrijven. Dat is ongeveer 175 pagina's. Er is geen jury die de duizenden inzendingen leest. Winnaar is iedereen de 50 duizend woorden haalt. Het is een mooi doel dat hopelijk veel mensen inspireert om eindelijk een keer te gaan zitten en die roman die al jaren in hun hoofd zit nu eens op te schrijven.

Ik heb ook zo'n roman in mijn hoofd zitten en potentieel nog wel meer dan één ook. Ik heb dit jaar dus meegedaan aan nanowrimo. Al snel werd duidelijk dat ik de 50 duizend bij lange na niet ging halen. Wel heb ik de helft gehaald, om precies te zijn 26.245. Omdat dit toch al gauw 26.245 woorden meer zijn dan aan het begin van de maand ben ik zelf heel erg tevreden. Ik vond het leuk om te doen en het smaakt naar meer. Ik ben dan ook van plan vrolijk door te schrijven. Het verhaal is nog lang niet af en ik ben benieuwd hoe het afloopt.

Het is een fantasyverhaal. Alle hoofdpersonen zijn draken. Als je dat niet interessant vindt, kan je beter niet verder lezen. Als dat gegeven je niet afschrikt, lees dan een klein voorproefje van het verhaal (het eerste deel van wat voorlopig hoofdstuk 7 is) en laat me weten wat je ervan vind.

Bekijk hier de PDF (negen pagina's).

Dragons

published Nov 30, 2010, last modified Oct 25, 2011

Read a preview of what may become a novel by me.

Every year the month of November is proclaimed National Novel Writing Month. This originally started in America, but it has gone international since. In essence it is a competition against yourself. You have got thirty days to write a short novel of fifty thousand words. That is roughly 175 pages. There is no jury that reads the entries by the tens of thousands of participants. The winner is every one who reaches 50,000 words. It is a nice goal that hopefully inspires lots of people to finally sit down and actually write that novel that has been in their head for years.

Such a novel is in my head as well; potentially more than one, even. So this year I participated in nanowrimo. Quickly it became clear that I would not reach the 50 thousand words by far. I did get to half of that, 26,245 to be exact. As is this roughly 26,245 words more than at the beginning of the month, I am very satisfied. I liked doing this and it has whet my appetite, so I plan to happily continue writing. The story is not nearly finished and I long to know how it ends.

It is a fantasy story. All main characters are dragons. If you don't think this is interesting, you should not read on. If this does not scare you, you can read a small English preview of the story (PDF, 3 pages) and let me know what you think. Note that if you can read Dutch, you should read the larger original Dutch preview (PDF, 8 pages). I wanted to translate more, but stopped as this distracted me from finishing the Dutch version, which could in itself take some years still. Also, the preview is not the beginning of the book, as I wanted to show a more interesting part of the story; this probably means I should write a more interesting beginning. I can then translate that for a preview instead.

Anyway, I hope you like it. Feedback is welcome via the contact form.

Python Users Netherlands meeting

published Nov 03, 2010, last modified Nov 04, 2010

Summary of the Python Users Nederland meeting in Arnhem, 3 november 2010.

Rob Gietema: Deco

I will talk about Deco and some more of Plone 4. I work for Four Digits, who organized this PUN. Originally four people, now seven. Since a few years we do only Plone. I myself do mostly front-end development, like integration of the TinyMCE visual editor in Plone.

Plone is a CMS. One of the current problems is creating composite pages. There are add-ons for that, but it is still crufty. Deco is meant to improve that a lot. In 2008 several people came with a proposal for that. Deco as front-end, Blocks as back-end.

Deco is a grid-based system. So you create multiple columns that you can style with CSS. The columns can be filled with tiles. We have structure tiles, like rich text. Also field tiles, like a title, description, list of tags. And application tiles, which can be anything: image, discussion forum, table of contents, multi-file upload.

The idea was good, but there were not a lot of people who wanted to write the javascript needed for that. But I do like to do that. :-)

We sprinted a few times on this. Four Digits hosted the Living Statues Sprint, there was a sprint at the Plone Conference in Bristol last week.

We created a demo website using Deco: http://decobrewery.com/. I will demo that now.

This is mostly for Plone 5, but parts will be available in upcoming Plone 4.x versions.

The parts involved in Deco are currently split over about 14 small python packages.

Create your own tile: an interface class with a schema, a class with a __call__ method that returns some html (can be in an html template), and some zcml to register this and glue everything together.

To do: create more templates for content types, fix bugs.

Want to code on it? Use https://svn.plone.org/svn/plone/plone.app.deco/buildouts/dev

It actually works in IE6 as well!

Reinout van Rees: checkoutmanager

checkoutmanager is a small tool to manage all your checkouts on your whole file system. You have 20 personal projects, 30 client projects, some dotfiles in your home dir. Just manage them all. I created checkoutmanager when I switched to a new laptop. Use it to checkout git, subversion, bazaard, mercurial. Every morning I do a checkoutmanager up to update all checkouts. I do checkoutmanager st to see which files in all my checkouts I forgot to commit. Also checkoutmanager out to see which local commits from git or mercurial I have not pushed to the central server yet. (To do: mention this in the docs.)

See http://pypi.python.org/pypi/checkoutmanager

Roel Bruggink: Subversion pre-commit hooks for pyflakes, pep8

I installed pre-commit hooks on our subversion to disallow commits that go against pyflakes and pep8. I wrote some code that made it possible to add a comment in a file to ignore one or more PEP8 style checks. Hooked it up to TextMate to prevent you from saving a file with PEP8 problems, except when you explicitly specify it with that comment. Handy for those times where you really can't help it. If you want the code, mail me.

Lars van de Kerkhof: Hudson and Fabric

Hudson is a Java tool for continuous integration. It basically just runs a shell script for you and reports the results back. Usually those are test results. We use it for deployment as well, but of course only when the test requirements are met. We let it use Fabric for that. It is tricky to get Fabric to use the correct virtualenv, but we got that working. I also made a way to print a shell script that looks like what Fabric would do for real.

Rob Gietema: XDV/Diaza/Deliverance for theming

XDV uses XSLT to get html from for example Plone and transform and push it into an html template that your designer has created. Nice alternative way to do theming. You can also combine multiple sources, not just from Plone, but from other systems as well at the same time.

Varundev Kashimath: Why do certain products succeed?

Working at TU Delft. We did some research into how long it takes to do a project with Rails and with Django. Rails took longer in this case. Some discussion followed, hard to summarize.

Vincent Pretre (Zest Software): jquery.pyproxy

published Nov 02, 2010

Lightning talk during the Dutch Plone User Day 2010 in the Euromast, Rotterdam. Also, cheap way of pointing Dutch readers to the Dutch summary of the whole day.

Vincent Pretre is lead developer at Zest Software for http://prettigpersoneel.nl, a hosted service for Human Resource Management for small to medium sized companies. The site uses Products.plonehrm, collective.sendaspdf and: jquery.pyproxy.

The idea is to replace KSS with jQuery for Ajax requests. Modify the DOM with python. We wanted it to be easy to use on client (browser) and server side. Keep jQuery syntax as close as possible. It should also be as extensible as jQuery, so existing plugins should work. It can be used as jQuery plugin.

pyproxy binds a call to an event. There is also pyproxy_call. In python: @jquery defines a view as callable by jquery.pyproxy. JQueryProxy: an object used to modify the DOM. extend_grammar: defines plugins syntax.

Current limitations: you cannot do a chained call, cannot save a query, cannot have functions as parameters (so no callbacks).

It is stable: used on production for months. Works with Plone and Django (can be extended to other frameworks), works with Firefox, Chrome, IE, WebKit.

The product is hosted on github. See the README there. Releases are available on PyPI (0.2 released on 22 October 2010).

See the slides.

More Dutch

But wait, there is more... if you are Dutch! I have a Dutch overview of all the lightning talks and a Dutch summary of all the talks.