done.
http://www.web2py.com/AlterEgo/default/show/247


On Aug 3, 10:19 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Dan,
>
> can you post an AlterEgo entry about this? It would be useful to other
> users. Email me if you need the edit code.
>
> Massimo
>
> On Aug 4, 12:03 am, Dan <danbr...@gmail.com> wrote:
>
> > Hi David-
> > Yes, I'm usingGAE'staskqueue with web2py, and it works in both the
> > dev and production environments. Note that in the dev environment, the
> > tasks do not run automatically - you will need to manually trigger
> > them using thehttp://localhost:8080/_ah/adminwebconsole.
>
> > I wasn't able to get the url-encoded payload variable working
> > properly, so I tried the other method that uses a params dictionary
> > and it worked OK. (I'm not a python expert, so it's quite likely that
> > I was doing something wrong with urllib.) In any case, here is the
> > code snippet that works for me to create atask:
>
> > if request.env.web2py_runtime_gae: # if running on Google App Engine
> >     from google.appengine.api.labs import taskqueue
>
> > tqparams = {'row_id':r}
> > taskqueue.add(
> >   url=URL(r=request, c='mycontroller', f='call/run/taskfunction'),
> >   params=tqparams,
> > )
>
> > and the controller file that gets called has these lines in it
> > (simplified for this example):
>
> > def call():
> >     return service()
>
> > @service.run      ## we'll use this to enable this as a taskqueue-
> > friendly URL
> > def taskfunction():
> >     """
> >    For security, this URL should be restricted to the admin user in
> > app.yaml
> >     """
> >     return dict(row_id=request.vars.row_id)
>
> > On Jul 31, 11:38 am, David Watson <davidthewat...@gmail.com> wrote:
>
> > > Has anybody had any luck getting the taskqueue from google app engine
> > > to work in web2py? I presume that it should work under dev_appserver,
> > > but isn't working for me.
>
> > > I defined a simple default controller based on thegaeexample at the
> > > google blog:
>
> > > def process_post_file():
> > >     rows=db(db.files.processed=='False').select(db.files.ALL)
> > >     for row in rows:
> > >         f = row.file_blob
> > >         email_addresses = f.split('\n')
> > >         for email_address in email_addresses:
> > >             taskqueue.add(url='/init/default/sendmail', params=dict
> > > (to=email_address, subject='Hello ' + email_address, body='this is a
> > > message!'))
> > >     return dict(message=T('mail was queued'))
>
> > > def sendmail():
> > >     mail.send_mail(
> > >             '....@my.com', # needs to be from settings
> > >             request.vars['to'],
> > >             request.vars['subject'],
> > >             request.vars['body'])
>
> > > but my sendmail function never gets called. Everything seems fine up
> > > through thetaskqueue, but no callback.
>
> > > Thanks,
> > > David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to