Instead of using the *request* object, look at how to create a separate instance of the mailer API exclusively for your Celery tasks ( http://pyramid-mailer.readthedocs.org/en/latest/#getting-started-the-harder-way). Since your Celery app has no knowledge of your Pyramid application, you will need to read in your .INI file settings separately to create your mailer API.
On Wed, Jun 25, 2014 at 3:39 AM, Chung WONG <[email protected]> wrote: > Let's say there is a task: > > from pyramid_mailer import get_mailer > from celery import Celery > from celery.schedules import crontab > > class Config: > CELERYBEAT_SCHEDULE = { > 'every-minute': { > 'task': 'send_mail', > 'schedule': crontab(minute='*/1'), > * 'args': ??,* > }, > } > > app = Celery() > app.config_from_object(Config) > > @app.task > def send_mail(*request*): > mailer = get_mailer(*request*) > #send email..... > > > If it is to be set up as a scheduled task, how can I deal with the > required "*request*" object? > Or should I just use *DummyRequest* to fake it? Does it still get all the > settings in .*INI* ? > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/pylons-discuss. > For more options, visit https://groups.google.com/d/optout. > -- Vincent Catalano Software Engineer and Web Developer, (520).603.8944 -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
