[REF] changed coding style from datetime.datime.foo to datetime.foo, changing the import accordingly

bzr revid: rvalyi@gmail.com-20091214152104-evcck2uv66bbulnf
This commit is contained in:
Raphaël Valyi
2009-12-14 13:21:04 -02:00
parent 6e2d1e6b71
commit 1cbec3a642
5 changed files with 13 additions and 13 deletions
+3 -3
View File
@@ -21,7 +21,7 @@
##############################################################################
import time
import datetime
from datetime import datetime
from dateutil.relativedelta import relativedelta
import netsvc
import tools
@@ -101,10 +101,10 @@ class ir_cron(osv.osv, netsvc.Agent):
cr = db.cursor()
try:
if not pool._init:
now = datetime.datetime.now()
now = datetime.now()
cr.execute('select * from ir_cron where numbercall<>0 and active and nextcall<=now() order by priority')
for job in cr.dictfetchall():
nextcall = datetime.datetime.strptime(job['nextcall'], '%Y-%m-%d %H:%M:%S')
nextcall = datetime.strptime(job['nextcall'], '%Y-%m-%d %H:%M:%S')
numbercall = job['numbercall']
ok = False
+4 -4
View File
@@ -29,7 +29,7 @@ import libxslt
import locale
import time, os
import datetime
from datetime import datetime
class report_printscreen_list(report_int):
def __init__(self, name):
@@ -178,19 +178,19 @@ class report_printscreen_list(report_int):
if fields[f]['type'] == 'date' and line[f]:
format = str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'))
d1 = datetime.datetime.strptime(line[f],'%y-%m-%d')
d1 = datetime.strptime(line[f],'%y-%m-%d')
new_d1 = d1.strftime(format)
line[f] = new_d1
if fields[f]['type'] == 'time' and line[f]:
format = str(locale.nl_langinfo(locale.T_FMT))
d1 = datetime.datetime.strptime(line[f], '%H:%M:%S')
d1 = datetime.strptime(line[f], '%H:%M:%S')
new_d1 = d1.strftime(format)
line[f] = new_d1
if fields[f]['type'] == 'datetime' and line[f]:
format = str(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'))+' '+str(locale.nl_langinfo(locale.T_FMT))
d1 = datetime.datetime.strptime(line[f], '%Y-%m-%d %H:%M:%S')
d1 = datetime.strptime(line[f], '%Y-%m-%d %H:%M:%S')
new_d1 = d1.strftime(format)
line[f] = new_d1
+3 -3
View File
@@ -25,7 +25,7 @@ import cStringIO
import base64
import copy
import locale
import datetime
from datetime import datetime
import os
import re
import time
@@ -109,7 +109,7 @@ class _date_format(str, _format):
def __str__(self):
if self.val:
if hasattr(self,'name') and (self.name):
date = datetime.datetime.strptime(self.name, DT_FORMAT)
date = datetime.strptime(self.name, DT_FORMAT)
return date.strftime(self.lang_obj.date_format)
return self.val
@@ -266,7 +266,7 @@ class rml_parse(object):
except:# sometimes it takes converted values into value, so we dont need conversion.
return str(value)
else:
date = datetime.datetime(*value.timetuple()[:6])
date = datetime(*value.timetuple()[:6])
return date.strftime(date_format)
return self.lang_dict['lang_obj'].format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary)
+1 -1
View File
@@ -87,7 +87,7 @@ def _eval_xml(self,node, pool, cr, uid, idref, context=None):
a_eval = node.get('eval','')
if len(a_eval):
import time
import datetime
from datetime import datetime
idref2 = idref.copy()
idref2['time'] = time
idref2['DateTime'] = datetime
+2 -2
View File
@@ -20,7 +20,7 @@
##############################################################################
import os
import datetime
from datetime import datetime
from os.path import join
import fnmatch
@@ -280,7 +280,7 @@ class TinyPoFile(object):
'version': release.version,
'modules': reduce(lambda s, m: s + "#\t* %s\n" % m, modules, ""),
'bugmail': release.support_email,
'now': datetime.datetime.now().isoformat(' ')[0:-7] + '+0000',
'now': datetime.now().isoformat(' ')[0:-7] + '+0000',
}
)