Re: [web2py] Re: Implementing task queue using web2py

2012-02-16 Thread howesc
for writing files to the blobstore see the GAE docs: 
http://code.google.com/appengine/docs/python/blobstore/overview.html#Writing_Files_to_the_Blobstore


[web2py] Re: Implementing task queue using web2py

2012-02-16 Thread Saurabh S
Now the task queue is working fine. I have another problem. I am
generating a csv file.. Now since its running at background there will
not be any popup so I want to attach the file as an attachment in mail
and send or store the file in blobstore and send the link to user.

This is my code:

def report_download(result, colnames):
import cStringIO
stream = cStringIO.StringIO()
logging.info('Before sending to render_report_csv')
render_report_csv(stream, result, colnames=colnames)
logging.info('After render_report_csv')
filename = '%s-%s-%s.csv' % (request.function, request.args(0),
request.now)
logging.info(filename)
response.headers['Content-Type'] = 'text/csv'
response.headers['Content-Disposition'] = 'attachment; filename=
%s' % filename
logging.info('print stream')
mail.send(to='rohit.agumbe.ram...@accenture.com', subject='Report
Download',message='')

return stream.getvalue()

please suggest me on how to attach the csv to mail or get the blob url
of file stored in blob

Thanks

On Feb 14, 9:08 pm, Christian Foster Howes  wrote:
> what is the error in the logs when the task fails?  what is the URL
> shown in the task list?  something is either amok with the URL itself,
> or something is causing that function to fail when called via the task
> queue.
>
> On 2/13/12 20:05 , Saurabh S wrote:
>
>
>
> > It worked when I passed a different controller in the url other than
> > the one it is being called from.
>
> > It is production.
> > I checked the task queue it simply retries continuously if the same
> > controller is provided.
> > No params is not a mandatory argument to takqueue.add() I guess.
> > Because it does not throw any syntax error if not provided.
>
> > On Feb 10, 8:52 pm, howesc  wrote:
> >> some questions/thoughts:
>
> >>   - local test server or production?
> >>   - did you check the task queue?  in production go to the admin console 
> >> and
> >> find the task queues link.  in local test go to /_ah/admin and find the
> >> task queue link
> >>   - is params a required argument to taskqueue.add()?  i don't know if i
> >> always use it cause i need it or cause it is required.


Re: [web2py] Re: Implementing task queue using web2py

2012-02-14 Thread Christian Foster Howes
what is the error in the logs when the task fails?  what is the URL 
shown in the task list?  something is either amok with the URL itself, 
or something is causing that function to fail when called via the task 
queue.


On 2/13/12 20:05 , Saurabh S wrote:

It worked when I passed a different controller in the url other than
the one it is being called from.

It is production.
I checked the task queue it simply retries continuously if the same
controller is provided.
No params is not a mandatory argument to takqueue.add() I guess.
Because it does not throw any syntax error if not provided.

On Feb 10, 8:52 pm, howesc  wrote:

some questions/thoughts:

  - local test server or production?
  - did you check the task queue?  in production go to the admin console and
find the task queues link.  in local test go to /_ah/admin and find the
task queue link
  - is params a required argument to taskqueue.add()?  i don't know if i
always use it cause i need it or cause it is required.







[web2py] Re: Implementing task queue using web2py

2012-02-14 Thread Wikus van de Merwe
If it worked with different controller my guess is still that the URL you 
are passing is wrong.
Try to simplify it to: taskqueue.add(url=URL('hello'))


[web2py] Re: Implementing task queue using web2py

2012-02-13 Thread Saurabh S
It worked when I passed a different controller in the url other than
the one it is being called from.

It is production.
I checked the task queue it simply retries continuously if the same
controller is provided.
No params is not a mandatory argument to takqueue.add() I guess.
Because it does not throw any syntax error if not provided.

On Feb 10, 8:52 pm, howesc  wrote:
> some questions/thoughts:
>
>  - local test server or production?
>  - did you check the task queue?  in production go to the admin console and
> find the task queues link.  in local test go to /_ah/admin and find the
> task queue link
>  - is params a required argument to taskqueue.add()?  i don't know if i
> always use it cause i need it or cause it is required.
>
>


[web2py] Re: Implementing task queue using web2py

2012-02-10 Thread howesc
some questions/thoughts:

 - local test server or production?
 - did you check the task queue?  in production go to the admin console and 
find the task queues link.  in local test go to /_ah/admin and find the 
task queue link
 - is params a required argument to taskqueue.add()?  i don't know if i 
always use it cause i need it or cause it is required.



[web2py] Re: Implementing task queue using web2py

2012-02-10 Thread Wikus van de Merwe
Check the app engine requests log to make sure the right task URL is being 
used.