When I run manage.py send_email_alerts, I get the following error in my OSQA log file:

/usr/local/osqa/forum/management/commands/send_email_alerts.py TIME: 2010-09-21 16:06:24,002 MSG: send_email_alerts.py:handle_noargs:80 Unable to set the locale in the send emails cron job

My settings_local.py file correctly sets the locale:

LANGUAGE_CODE = 'en'

Other than this error, the application seems to be working normally, with no errors in the log.

How can I correct this error to ensure digest emails are sent correctly?

asked 21 Sep '10, 02:15

Kevin%20Yank's gravatar image

Kevin Yank
436111824
accept rate: 28%

Maybe this is related to an issue that we are experiencing: our email alerts are sent in English but we have LANGUAGE_CODE = 'es'

http://meta.osqa.net/questions/4336/how-to-send-the-digest-using-the-site-language

(21 Sep '10, 04:05) Oscar ♦

It's related because whats causing @Kevin error is a piece of code used to try and make other locales work on digests.

(21 Sep '10, 05:48) Hernani Cerq... ♦♦

@Kevin, are the emails being sent anyway?

(21 Sep '10, 10:58) Hernani Cerq... ♦♦

@Hernâni Yep, they are. Both digests and instant notifications are going out.

(21 Sep '10, 22:56) Kevin Yank

@Hernani has the digest code changed recently? I this is the case I could test if emails are now sent with the right locale.

(27 Sep '10, 06:30) Oscar ♦

@Oscar, no, is the same code it was before. It tries to set the locale prior to creating and sending the notifications, thus the error @Kevin is observing.

(27 Sep '10, 06:41) Hernani Cerq... ♦♦

@Hernani ok, thanks, please let me know if I can test something, I am really looking forward for this fix.

(27 Sep '10, 06:44) Oscar ♦
showing 5 of 7 show 2 more comments

I had to add from django.utils import translation at the top of the send_email_alerts.py file and that fixed it.

link

answered 03 Mar '11, 11:51

gperrow's gravatar image

gperrow
24651523
accept rate: 25%

That was fixed several months ago. I guess you need to update your code ;)

http://svn.osqa.net/browse/OSQA/osqa/trunk/forum/management/commands/send_email_alerts.py?r=HEAD

(03 Mar '11, 12:45) Hernani Cerq... ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×156
×101
×30
×8

Asked: 21 Sep '10, 02:15

Seen: 680 times

Last updated: 03 Mar '11, 12:45

powered by OSQA