To install virtualbox in ubuntu:
sudo apt-get install virtualbox-ose
sudo apt-get install nautilus-open-terminal
>>> import random
>>> a = random.randint(1,99)
>>> a
77
>>> b = random.uniform(1,999)
>>> b
766.6455229055509
>>> c = random.random()
>>> c
0.6372421095384033
>>>
>>> import PythonMagick
>>> pdf = 'Invoices.pdf'
>>> p = PythonMagick.Image()
>>> p.density('600')
>>> p.read(pdf)
>>> p.write('test_image.jpg')
>>>
>>> import timeEx:
>>> time.strftime("format")
>>> import time
>>> time.strftime("%d-%m-%Y")
'20-05-2014'
>>> time.strftime("%d-%m-%Y %H:%M:%S")Current date in Python using 'datetime' module
'20-05-2014 12:17:51'
>>> import datetimeChange date format using time module
>>> now = datetime.datetime.now()
>>> now
datetime.datetime(2014, 5, 20, 12, 19, 16, 547221)
>>> now.year
2014
>>> now.month
5
>>> now.day
20
>>> now.hour
12
>>> now.minute
19
>>> now.second
16
>>> now.microsecond
547221
>>>
time.strftime('required format', time.strptime('date data', 'source format'))Ex:
>>> import timeConvert date to datetime using datetime module
>>> d1 = time.strftime('%d-%m-%Y', time.strptime('2014-05-10', '%Y-%m-%d'))
>>> d1
'10-05-2014'
>>>
>>> from datetime import datetime
>>> d1 = datetime.strftime(datetime.strptime('2014-05-10', '%Y-%m-%d'), "%Y-%m-%d 00:00:00")
>>> d1
'2014-05-10 00:00:00'
>>> d2 = datetime.strftime(datetime.strptime('2014-05-10', '%Y-%m-%d'), "%Y-%m-%d 23:59:59")
>>> d2
'2014-05-10 23:59:59'
>>> d1, d2
('2014-05-10 00:00:00', '2014-05-10 23:59:59')
>>>
import string
import random
from random import sample
def create_password(self):
"""
create a random password
"""
rand = string.ascii_letters + string.digits
length = 8
passwd = ''.join(sample(rand, length))
return passwd
>>> import string
>>> import random
>>> from random import sample
>>> rand = string.ascii_letters + string.digits
>>> length = 8
>>> passwd = ''.join(sample(rand, length))
>>> passwd
'8fK6ZR0q'
>>>
=== modified file 'openerp/report/render/rml2pdf/trml2pdf.py'
--- openerp/report/render/rml2pdf/trml2pdf.py 2012-07-16 07:52:17 +0000
+++ openerp/report/render/rml2pdf/trml2pdf.py 2012-07-19 10:16:33 +0000
@@ -743,6 +743,8 @@
style.__dict__.update(extra_style)
result = []
for i in self._textual(node).split('\n'):
+ if len(i.strip()) == 0:
+ i = '<font color="white"> </font>'
result.append(platypus.Paragraph(i, style, **(utils.attr_get(node, [], {'bulletText':'str'}))))
return result
elif node.tag=='barCode':
<xpre style="terp_default_9">[[ format(o.note or '') ]]</xpre>