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-20101127201408-gnn6js103fbpw8ou
This commit is contained in:
P. Christeas 2010-11-27 22:14:08 +02:00
parent fb58e0c8fb
commit 749e24645e
1 changed files with 6 additions and 14 deletions

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