From 1cbec3a6429f49189ec25ef6dcef9407a16cba5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Mon, 14 Dec 2009 13:21:04 -0200 Subject: [PATCH] [REF] changed coding style from datetime.datime.foo to datetime.foo, changing the import accordingly bzr revid: rvalyi@gmail.com-20091214152104-evcck2uv66bbulnf --- bin/addons/base/ir/ir_cron.py | 6 +++--- bin/report/printscreen/ps_list.py | 8 ++++---- bin/report/report_sxw.py | 6 +++--- bin/tools/convert.py | 2 +- bin/tools/translate.py | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/addons/base/ir/ir_cron.py b/bin/addons/base/ir/ir_cron.py index f841bdbb759..dcf76945904 100644 --- a/bin/addons/base/ir/ir_cron.py +++ b/bin/addons/base/ir/ir_cron.py @@ -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 diff --git a/bin/report/printscreen/ps_list.py b/bin/report/printscreen/ps_list.py index 1496077a2c5..a131848cfac 100644 --- a/bin/report/printscreen/ps_list.py +++ b/bin/report/printscreen/ps_list.py @@ -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 diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index 987ec9c4b58..fafbf4a9172 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -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) diff --git a/bin/tools/convert.py b/bin/tools/convert.py index 73b4d453b76..b6ed68f2f11 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -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 diff --git a/bin/tools/translate.py b/bin/tools/translate.py index 99218a91f70..c4dc1bb0617 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -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', } )