Hacker News new | past | comments | ask | show | jobs | submit login
Scheduling morning emails with Python and Celery (cucumbertown.com)
56 points by deepakprakash on Feb 15, 2013 | hide | past | favorite | 17 comments



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.


Agree. Its not the most useful class.



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


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


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


While we're on the topic -- there's also http://mailchimp.com/ if you want to outsource the job of sending subscription e-mail.


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


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.


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.


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.


This doesn't handle daylight saving time.



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.


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.


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.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: