email_template: cleanup the startup warning lines.

Multiple coding malpractices (I can't name them errors, yet) were in those
lines:
 - they used the netsvc.Logger() interface, which is deprecated
 - they wrapped too much (we're not COBOL)
 - they used capital letters for an object
 - they defined a logger object that would live throughout the module
   life, although it would only be useful for startup
 - they used the gettext function, although there is absolutely no context
   around to provide a language.

bzr revid: p_christ@hol.gr-20101116145144-kwf7612bz0k1xzs2
This commit is contained in:
P. Christeas
2010-11-16 16:51:44 +02:00
parent 014cd44400
commit 75c212285a
+6 -14
View File
@@ -23,10 +23,9 @@
import base64
import random
import netsvc
import logging
import re
LOGGER = netsvc.Logger()
TEMPLATE_ENGINES = []
from osv import osv, fields
@@ -35,12 +34,9 @@ from tools.translate import _
try:
from mako.template import Template as MakoTemplate
TEMPLATE_ENGINES.append(('mako', 'Mako Templates'))
except:
LOGGER.notifyChannel(
_("Email Template"),
netsvc.LOG_WARNING,
_("Mako templates not installed")
)
except ImportError:
logging.getLogger('init').warning("module email_template: Mako templates not installed")
try:
from django.template import Context, Template as DjangoTemplate
#Workaround for bug:
@@ -49,12 +45,8 @@ try:
settings.configure()
#Workaround ends
TEMPLATE_ENGINES.append(('django', 'Django Template'))
except:
LOGGER.notifyChannel(
_("Email Template"),
netsvc.LOG_WARNING,
_("Django templates not installed")
)
except ImportError:
logging.getLogger('init').warning("module email_template: Django templates not installed")
import tools
import pooler