Current job: Enter phase 2

August 23, 2010

I’ve now spent 10 months in my current job, and I owe to myself to stop today for a quick restrospective before moving to another phase.

The first period (phase 1) helped me understand the context and what can be done to bring value. Fortunately, a lot can be done, so the challenge is interesting. Also, I was lucky to quickly understand and accept that, in the current context, change could only happen progressively.

Saying that nothing interesting has happened so far with the projects I am in charge of, would not be true. But the whole process is too slow (or sometimes chaotic), for unnecessary reasons.

My phase 2 is going to involve more initiatives to pick up the pace on the projects and get things moving. Wish me good luck or my next related post will be about asking if someone has a job opportunity for me ūüėČ

As for other news, I restarted developing for personal projects with my favourite CMS (which is preparing a new release). I wish all success to Plone 4 and the community. If you need a CMS for a critical/complex site project, Plone is undoubtly in the top 2 or 3. Also, we have a great community which opens to various technologies and development practices besides Plone such as Zope Toolkit, ZODB, Deliverance,, and BFG, to only name a few.

Scratching my own documentation itch

March 21, 2009

A week ago, I finished updating the Archetypes Developer Manual for Plone 3. In case you have not seen it, the new version is interesting for any developer who has to develop or update an Archetypes-based product ; it tries to present our current coding practices (GenericSetup, ZCA techniques…) The manual is accompanied by a new example package. It is also useful, directly, for the “what does what/how to” when using the ZopeSkel “archetype” template with paster to bootstrap your product package.

What’s next ?

I started another manual to give an overview of the Zope Component Architecture techniques and tools we use for Plone development. Part of the initial work is refactoring/merging existing howtos and tutorials written by the other documentation contributors, and updating them. Hopefully, a first cut of this manual will be reviewed and published in a few weeks.

Sprinting at Pycon

Next week, I am going to Pycon in Chicago and will have 2 days to participate to the post-conference sprints. My current plan is to just dedicate my time to documentation. Topics that I may start contributing on are “Dexterity content types” and “WSGI setup for Plone (3/4) + using middlewares to augment your deployment”. There may be other topics to give priority to, and I will discuss with others to find out. And of course, I will have some time to make progress on the ZCA manual.

Looking forward to meet other “Python Web” community members there!

Promoting Python and Plone in Africa

November 7, 2008

It seems that only South Africa had an event listed as part of the World Plone Day set of local events. As an african, I am of course interested by this fact, and I would have expected some Plone presence in another region. Hopefully, we can fix that for next year’s edition !

I am promoting an effort called Python African Tour which aims at sending volunteers, within the next couple of years, in the different regions of Africa, based on sponsoring, to train beginner developers there on Python and its related technologies. It’s a way to introduce newbies there to a programming language that helps the developer get his job done, as well as all the community practices that help us improve our daily work. It’s also a way to get new developers join the Python community.

The first country the tour will visit is Morocco, in December, from the 18th to the 22nd. Among the possible countries to plan in 2009 are Nigeria and South Africa. Obviously our plans will depend on discussions with local contacts we get, and sponsoring possibilities.

For Morocco, Amine Soulaymani, a developer living in Morocco, and Daniel Nouri have volunteered to participate as instructors for the students at Ecole Mohammedia d’Ingenieurs, ¬≠the school that will host the Python training session.
In addition to the training session during the first 2 days, we plan to have 3 days of community activities: an unconference-style open event with demos and talks related to Python, followed by a sprint that will be hosted in the offices of Nextma, a solution provider doing Python. Talks and sprint activities should cover Plone, with the participation of a PloneGov / CommunesPlone team joining us from Belgium, WSGI / Repoze and ­OpenERP with contributors from Nextma.

On a side note, I have proposed a talk with Roberto Allende for next year’s Pycon to present our ideas and actions to help spread Python in both South America and Africa.

If you want to contribute in any way, ¬≠¬≠contact us through the project’s mailing list.

Not at the Plone conference

October 7, 2008

Unfortunately, I was unable to go to DC for the Plone conference.

I want to apologize to the people who were expecting to follow the tutorial on z3c.form, which had to be canceled.

I am thinking about submitting an improved version of that tutorial proposal for Pycon 2009, and I hope to be there and meet some of you.

Have fun, and let the people know it ! Zope is back (in various forms ;)), and we are going toward more successes in the coming years.

More on using the EditForm

September 17, 2008

I now better understand this after reading z3c.form’s doctests: If the context object that you want to edit fulfills the interface used for your EditForm, the code for defining the form class could be as small as this (followed by the usual configure.zcml snippet):

class ContactEditForm(z3c.form.form.EditForm): """ Contact Edit Form """ fields = z3c.form.field.Fields(IContactData) # For wrapping the form presentation within Plone's layout ContactEditFormView = layout.wrap_form(ContactEditForm, label="Edit Form")

If it does not, you get an error as the framework finds that the object does not match the schema or there is not an adapter to it.

The solution in such a case is to define an adapter to the interface, and override the getContent() method of the form to give the adapted object to the EditForm so it can do its job on it, i.e. update it.

Here is an example with an ATDocument used as the context.

class ContactAdapter(object): zope.component.adapts(IATDocument) zope.interface.implements(IContactData) def __init__(self, document): self.document = document @apply def lastname(): def get(self): return getTheLastname(self.document) def set(self, value): setTheLastname(self.document, value) return property(get, set)
class ContactEditForm(z3c.form.form.EditForm): """ Contact Edit Form """ fields = z3c.form.field.Fields(IContactData) def getContent(self): '''See interfaces.IForm''' return IContactData(self.context)

This approach is valid for cases where you don’t want to introduce a new content type. Hopefully, there will be a time when introducing a new type would be easier, not require too much things to change, and not add complexity to your Plone site with the risk of maintenance issues. (I’m thinking plone.dexterity here.) Then, things should be straightforward.

You can find the detailed code of my z3c.form usage examples in the
example.z3cform package in the Collective.

Update: Do not forget to register the Adapter in the configure.zcml. (Thx to Gilles for informing me that I forgot to mention this bit.)

<adapter factory=‚ÄĚ.adapter.ContactAdapter‚ÄĚ />

Example code for getting started with z3c.form forms

September 13, 2008

I have been working on an example package to show how to get started with z3c.form-based forms in Plone, and this helps me prepare myself for the tutorial session I will lead at the Plone conference.

I just updated the code, to end my day at the Paris Bobun Sprint, by adding a technique you can use – based on a feature of the framework – when you want to provide your own specific error message on a field’s validation (a common need, when you are improving a form’s usability for the users). I will explain this feature in detail in a next post.

My tentative TODO list for the next days/weeks is:

  • Write tests
  • An example of custom widget
  • An example of data converter (maybe)
  • An example of using AjaX (jQuery, KSS) to improve the forms’s usability

You can check the code in the collective ( and send me feedback, suggestions, or questions.

Enjoy !

Updating your form code to latest version of plone.z3cform

July 26, 2008

I am glad to see more work is happening for using z3c.form in CMF and Plone, and Daniel Nouri updated us this week with the latest changes. I just updated my buildout to use the new packages and got plone.z3cform 0.4 and 0.3.2.

With the small API changes that happened, you can see below that there is less to write to expose the form in the Plone site (our ContactForm example from my
previous post):

# my.example/my/example/ import datetime from zope import schema import zope.component import z3c.form import from import layout from plone.i18n.normalizer.interfaces import IIDNormalizer from my.example import interfaces from import MyContact class ContactForm(z3c.form.form.Form): """ Contact Form """ fields = z3c.form.field.Fields(interfaces.IContactData) message_field = z3c.form.field.Fields(schema.TextLine(__name__ = 'message', title=u"Message", required=False) ) fields += message_field ignoreContext = True @z3c.form.button.buttonAndHandler(u'Send', name='send') def handle_send(self, action): data, errors = self.extractData() if errors: self.status = z3c.form.form.EditForm.formErrorsMessage return # Add the contact data, if not in yet id = data['firstname'] + data['lastname'] id = zope.component.queryUtility(IIDNormalizer).normalize(id) if id not in self.context.objectIds(): self._name = id contact = MyContact(self._name, **data) self.context[self._name] = contact # Complete the code so it sends the message to the site admin... message = data['message'] print "Message from %s %s (%s):\n%s" % (data['firstname'], data['lastname'], data['email'], data['message']) self.request.RESPONSE.redirect(self.context.absolute_url()) # New way to provide the wrapping View ContactFormView = layout.wrap_form(ContactForm, label="Contact Form")

The related ZCML code does not change.
By the way, on my TODO list, is moving from ZCML to grokcore.component registration ūüėČ