ywxtd
unread,Apr 18, 2012, 4:28:40 PM4/18/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pylons-discuss
I'm trying to write a batch script, which is scheduled to run every
evening, and it will send out email to users who meet a certain
criteria. The user's language preference is stored in the db, so the
message being sent to users will have translation string. There are
two ways of doing is in my mind:
1. Write a dummy view callable to wrap the email sending logic, use
bootstrap to get the env, then simulate a request to call the view
callable. In this way I can use the global i18n setting which has been
done in the application startup, for example:
pyramid.config.Configurator.add_translation_dirs()
2. The whole logic is in the console script, but I have to setup the
i18n env manually.
Am I doing right or there is better way to implement this?