Two issues:

1) the download action should be

def download(): return response.download(request,db)

else if will not work on GAE

2) GAE has very limited storage size. I have doubts a PDF or DOC file
will fit. This may be the major cause of your problem.

Massimo

>     import os
>     path=os.path.join(request.folder,'uploads',request.args[0])
>     return response.stream(path)

On Mar 4, 9:42 am, Scott <[email protected]> wrote:
> Was reading through the forms. In previous posts, this was a t2
> issue.  I understand t2 has now been wrapped in elsewhere.
>
> I can get attachments (pdf/docs) to show using sqlite as a backend,
> but not GQL.  Here is my code:
>
> model
> -------
> db.define_table('news',
>    SQLField('author',db.person),
>    SQLField('author_alias'),
>    SQLField('title',length=128),
>    SQLField('abstract','text'),
>    SQLField('abstract_file','upload'))
>
> controller
> ---------
> def comments():
>     item=db(db.news.id==news).select()[0]
>     return dict(item=item)
> def download():
>     import os
>     path=os.path.join(request.folder,'uploads',request.args[0])
>     return response.stream(path)
>
> view
> -------
> <table>
> {{if item.abstract:}}
> <tr><td>{{=WIKI(item.abstract.strip())}}</td></tr>
> {{elif item.abstract_file:}}
> {{type=item.abstract_file.split('.')[-1]}}
> <tr><td>{{=A('link to abstract ['+type+']',_href=URL
> (r=request,f='download',args=[item.abstract_file]))}}</td></tr>
> {{pass}}
> </table>
>
> No errors, appears that the file is not being uploaded properly (the
> view returns None, indicating that neither an abstract(text) or
> abstract_file(link to doc/pdf) has been upload).  This is an
> adaptation of the Reddish app.
>
> Thanks
>
> Scott
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to