Sunday, August 26, 2012

Our KB project - going to Drupal

Very often we exchange tips with colleagues and partners. Things like do you have an example in OpenERP of a search / function field etc

Simply, we exchanges these by e-mail. Best of them go in mail folders.

When working on windows I am using OneNote (great MS office app with IMHO no open-source close equivalent).

I think these e-mails represent valuable material. Good for us during projects, but may be good for other people. So I decided to setup a knowledge-base web site where we can easily store and publish tips and code snippet.

My intention is to use Drupal instead of my usual Joomla. There are 2 keys reasons:

  • Taxonomy : in Joomla the section/category is limited and makes impossible to classify articles. World is not a 2 levels tree - n level (Joomla 2.5) is not better. What I am waiting for since at 7 years: be able to put 1 article in multiple categories... E.G python / openerp / query / partner etc
  • Front-editing : I just want to be able to login and change , cut and paste articles directly. The separation between the site and the admin may give security feeling for a classical site but is clear not appropriate for a community sharing site. 
Installing Drupal 7 is as easy as with Joomla.

Creating content-type is also easy to manage. In Drupal 7 the so called CCK is now a core module. One click and you are done.

However my first snippet post was disappointing... All the alignments are lost. Well for python samples with indent being semantically import the result was not that bad.

2 google search later? I found a Geshi filter module. Well a drupal module using a PHP library called GeSHI.

Much better than simply keeping indentation. It hilight source code syntax with colors for an incredible number of languages.

This is were  hughe communities of coder are incredibly good - thanks to all Drupaler and PHP guys and of course the GeSHI autors - you are great and you did my day !

Friday, August 17, 2012

openerp - paradise of extensibility

Here is an extract of one of the openerp kernel file:

class _column(object):

    def __init__(self, string='unknown', required=False, readonly=False, domain=None, context=None, states=None, priority=0, change_default=False, size=None, ondelete=None, translate=False, select=False, manual=False, **args):
        for a in args:
            if args[a]:
                setattr(self, a, args[a])

This last for loop is programmer paradise. It simply means you can create any field and add directly data to the field definition like a qualifier or anything you need in the constructor.

Simply cool, elegant and efficient !