I have tried to follow this tutorial:
http://www.web2pyslices.com/slice/show/1579/web2py-and-redis-queue
Just changed the arguments in the enqueue function to be fixed:
def contato():
form = SQLFORM.factory(Field("name"), Field("message"))
if form.accepts(request):
# enqueue the email to be sent!
job = q.enqueue(mail.send,
to="[email protected]", # I CHANGED THE EMAIL HERE
subject="test contacted you",
message="message")
# do whatever you want
response.flash = "email successfully sent!"
return dict(form=form)
But it gives me a error. After some time I figured out it was asking the
function name to be a string.
Traceback (most recent call last):
File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/home/www-data/web2py/applications/OPM/controllers/default.py", line
1772, in <module>
File "/home/www-data/web2py/gluon/globals.py", line 412, in <lambda>
self._caller = lambda f: f()
File "/home/www-data/web2py/applications/OPM/controllers/default.py", line
1750, in contato
message="message")
File "/usr/local/lib/python2.7/dist-packages/rq-0.5.3-py2.7.egg/rq/queue.py",
line 253, in enqueue
job_id=job_id, at_front=at_front)
File "/usr/local/lib/python2.7/dist-packages/rq-0.5.3-py2.7.egg/rq/queue.py",
line 215, in enqueue_call
return self.enqueue_job(job, at_front=at_front)
File "/usr/local/lib/python2.7/dist-packages/rq-0.5.3-py2.7.egg/rq/queue.py",
line 270, in enqueue_job
job.save(pipeline=pipeline)
File "/usr/local/lib/python2.7/dist-packages/rq-0.5.3-py2.7.egg/rq/job.py",
line 461, in save
connection.hmset(key, self.to_dict())
File "/usr/local/lib/python2.7/dist-packages/rq-0.5.3-py2.7.egg/rq/job.py",
line 427, in to_dict
obj['data'] = self.data
File "/usr/local/lib/python2.7/dist-packages/rq-0.5.3-py2.7.egg/rq/job.py",
line 227, in data
self._data = dumps(job_tuple)
File "/home/www-data/web2py/gluon/storage.py", line 56, in <lambda>
__getnewargs__ = lambda self: getattr(dict,self).__getnewargs__(self)
TypeError: getattr(): attribute name must be string
But if i do it I get another error, but this time on Redis side about it
could not import modules.
ImportError: No module named modules
Anyone had this problem? Couldn't figured out how to solve it.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.