Wednesday, November 17, 2010

Domain's value depending on condition

In OpenERP view depending on condition value for the right argument can be provided.

domain="[('product_tmpl_id.categ_id.name', 'ilike',
(parent.category in ('RM', 'PM') and parent.category) or
(parent.category == 'OM' and 'Other') or
'')]"

Friday, November 12, 2010

Python Magic

Serves Current Directory listing on 8000 port


$ python -m SimpleHTTPServer

Download HTML Page
$ python -m urllib http://www.python.org > python.html


Prints the year calendar, like the "cal" command.

$ python -m calendar

Works as a command line ftp client

$ python -m ftplib

Sends email using localhost smtp server as relay.

$ python -m smtplib