Hi,

My understanding is that Django is (or attempts to be) thread-safe,
and I'm hoping someone can help me track down this problem:

Part of my app uses django templates to create the content of an
email, which it then sends out.   The code is something like,

email = 'a...@def.com'
context = {'email': email}
body = render_to_string('template.html', context)
send_email(to=email, body=body)

where template.html is something like,
Hello, this email is being sent to {{ email }}.

And it's been working fine for over a year... but recently it was
brought to my attention that an email recipient didn't match the email
body - a few people had received emails that made no sense (the email
addresses in the "to" line and the body were different).

I did some searching, and there were a few concurrent requests at the
time; the mix-ups were with emails generated & sent within
milliseconds of each other, and I'm strongly suspect they were in
different requests/threads (based on the email addresses involved).

Is it possible (or known) that render_to_string isn't threadsafe
(django 1.2 / python 2.6)?  Or is the likely cause somewhere else?
Just trying to figure out the best place to start looking.

Thanks in advance!
Francis

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to