views: remove all uses of LoggerAdapter

This commit is contained in:
Benjamin Dauvergne 2013-11-29 10:22:48 +01:00
parent 4704690c5a
commit a87ab42812
1 changed files with 7 additions and 5 deletions

View File

@ -187,8 +187,9 @@ def send_file(request, file_type_id):
recipients_count=recipients_count)
return redirect('outbox')
except Exception:
logger = get_logger(request)
logger.exception('unable to create a new document')
import logging
logging.getLogger(__name__).exception('unable to create a new document')
form._errors.setdefault(NON_FIELD_ERRORS, form.error_class()) \
.append(_('An internal error occured, administrators '
'have been notified; sending seems blocked at the moment. You should '
@ -316,7 +317,6 @@ def help(request, pagename='index.html'):
def contact(request, template='docbow/contact.html',
form_class=AnonymousContactForm):
logger = get_logger(request)
user = request.user
if user.is_authenticated():
template = 'docbow/contact_user.html'
@ -356,8 +356,10 @@ def contact(request, template='docbow/contact.html',
message=message,
reply_to=reply_to,
phone=cleaned_data.get('phone_number'))
except smtplib.SMTPException, socket.error:
logger.exception('unable to send mail to administrators')
except (smtplib.SMTPException, socket.error):
import logging
logging.getLogger(__name__).exception('unable to send mail to administrators')
request.error_record('error', 'unable to send mail to administrators with '
'subject "{subject}" and message "{message}", reply should be sent to email '
'{reply_to} or phone number "{phone}"',