Personal tools
Earthquake? Plone to the rescue!

Jun 27, 2012

Earthquake? Plone to the rescue!

To work in Italy you need to be pragmatic. Very pragmatic. That's why when an earthquake hit our region last month we were more than happy to help. Check out what we have done in 72h using Plone, Pyramid and Facebook

The idea behind the project is simple: build a tool that will help suffered companies to sell their products. It should be intuitive and integrates with social networks to gain publicity. You probably heard about the parmigiano reggiano losses and the huge will to buy all the cheese that was left. Our project should help people do it much easier.

Check the site:


Most of the application is done in Plone, which is so fast to develop nowadays. We have used heavily eea.facetednavigation which saved us hours if not days. Big thanks to Alin Voinea, Alexandru Ghica, Antonio De Marinis. You guys rock!

We have implemented a custom facebook integration with a separate PAS plugin. We couldn't use plonesocial.auth.rpx cause we wanted to integrate more deeply with facebook app (more about that later), and that will cost a fortune using

We have also added a small disqus trick that notifies archetype object owner that somebody made a comment. We are using the callback method:

function disqus_config() {
    this.callbacks.onNewComment = [function(comment) {
         $.post('%(document_url)s/disqus_notify', {comment: comment});


and a browser view:

class Notify(BrowserView):
def __call__(self):
comment_text = self.request.form.get('comment[text]')
comment_id = self.request.form.get('comment[id]')
objectEventNotify(DisqusNotify(self.context, comment_id, comment_text))

you can find a working example on github.

We have also a separate Zope process that is collecting internal stats (products sold, value gained, etc.) mounted in a separate ZODB. In this case we have minimized the problem of ConflictErrors while having the stats always fresh.

pyramid / celery

Second important part of the project is the notification app. We are notifying users almost on every single user action (registration, creating company, adding products, buying, commenting, etc.). We are sending 3 types of notifications: email, sms and facebook (using open graph API). We wanted to have something async, easy to implement and stable. Pyramid_celery was the best choice.

Facebook and Open Graph

Last important part of the stack is the facebook integration. We wanted something more then simple authentication. We wanted to involved facebook users a bit more. Thanks to Open Graph it's quite easy.

First we have included the basic og meta tags in your <head> section. We have used an existing Plone product for that. Then we have registered several actions, objects and aggregations that correspondent to notifications I have mentioned before.

One of the action we have is sell. It can be used only with product object. In Plone you need to include in the <head> section of your product object additional meta:

<meta property="og:type" content="facciamoadesso:product" />

and then using your new action is trivial:

curl -F 'product=' \

and that's it. Well, almost. You need of course to handle the access_token (we did it with our custom PAS plugin explained above).

Once again many thanks to all Plone and pyramid developers whose add-ons we have used! It's truly amazing how much you can get in such a short time period.

Last, some code stats:

  • 21.274 lines of code
  • 4 contributors
  • 127 tickets closed
  • Most productive between 12:00-13:00 :-)


All the code is open source and can be found on RedTurtle's github repository

comments powered by Disqus