
Scheduling morning emails with Python and Celery - deepakprakash
http://www.cucumbertown.com/engineering/scheduling-morning-emails-with-django-and-celery/
======
clicks
While we're on the topic -- there's also <http://mailchimp.com/> if you want
to outsource the job of sending subscription e-mail.

------
yeison
Did anyone else read this title as: 'Scheduling morning meals with Python and
Celery'?

~~~
aqeel
Haha, its so funny! especially considering the fact that
<http://www.cucumbertown.com> is a recipe site :)

------
manish_gill
Isn't the ScheduleTime class doing redundant work? Why bother keeping a
dictionary, dealing with ints and strings when you can directly use
strftime/strptime?

Except for the friday/fri thing, which, to be honest, I don't see the point
of. I'd rather have uniformity in my code.

~~~
aqeel
Agree. Its not the most useful class.

------
est
alternatively: use uWSGI cron

[http://uwsgi-
docs.readthedocs.org/en/latest/PythonDecorators...](http://uwsgi-
docs.readthedocs.org/en/latest/PythonDecorators.html#uwsgidecorators.cron)

~~~
aqeel
Good one! People relying on Cron could benefit from this.

------
th
Would this create a problem around Daylight Saving Time until the user logs in
again to reset their time offset?

~~~
aqeel
getTimezoneOffset() would return the value after taking care of DST. So there
shouldn't be any DST related inconsistencies. Now if the user moves to another
timezone, and never hits one of our page, there is no direct way of tracking
his/her change in location.

~~~
th
I mean that starting mid-March a user who had previously been in a -8:00 UTC
offset would then be in a -7:00 UTC offset and you wouldn't know the timezone
offset changed until they visited the website again.

~~~
Cherian
That’s certainly a problem. But this solution is better than being totally
off. Worst case the person gets the mail in the previous timezone he
registered which should be before the DST.

------
ieze
This doesn't handle daylight saving time.

~~~
aqeel
It does take care of DST:
<http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp>

~~~
cyriacthomas
Wouldn't it be a better idea to store the timezone and then account for the
DST at the server side? <https://bitbucket.org/pellepim/jstimezonedetect>

getTimezoneOffset() gives you the offset with the DST accounted and will be a
different time when DST is off.

~~~
aqeel
When it comes to scheduling emails, what we want is user's to get emails at a
specific time as exactly as possible. For this all we need is the UTC timezone
offset including DST, which javascript gives us. The jstimezonedetect script
is a good one if we wan't to know the real timezone. Problem here is we
wouldn't know how often this script could remain updated. Any change in DST
will have to be provided by the script which if it doesn't there will be in-
accuracies. Not to mention the trouble of keeping the script updated. But in
general, the script is indeed awesome.

~~~
nsr
I believe that the point is: If you have the user's timezone, you can /know/
if they are in DST through modules such as pytz+datetime.

