I do not understand where you are getting the error but you can simply
do:

db.define_table('site',
                Field('pic1', 'upload', label ="Banner (125x125)"))

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

this works on GAE too because GAE will automatically create the
uploadfield for you.

Massimo

On Aug 10, 8:52 pm, Jon Romero <darks...@gmail.com> wrote:
> I have this table:
> db.define_table('site',
>                 Field('pic1', 'upload', uploadfield='data', label =
> "Banner (125x125)"),
>                 Field('data','blob',default=''))
>
> I also changed this in my controller:
> def download():
>     return site[db.site.pic1.uploadfield]
>
> Now I have some questions:
> First of all, is this line correct?
>     return site[db.site.pic1.uploadfield]
> or it should be
>     return site[db.site.pic1.data]
>
> Documentation here (http://www.web2py.com/AlterEgo/default/show/138)
> says it's the first but it doesn't make any sense (for the record none
> of them work)
>
> Secondly, I added session.connect in my db.py for all cases
> if request.env.web2py_runtime_gae:
>     db = DAL('gae')
> else:                                         # else use a normal
> relational database
>     db = DAL('sqlite://storage.sqlite')       # if not, use SQLite or
> other DB
> session.connect(request, response, db=db) # and store sessions and
> tickets there
>
> None of the combinations work. I get this error (running on GAE and on
> plain web2py server):
> Error traceback
> Traceback (most recent call last):
>   File "/home/jon/Sources/web2py/gluon/main.py", line 389, in wsgibase
>     session._try_store_in_db(request, response)
>   File "/home/jon/Sources/web2py/gluon/globals.py", line 339, in
> _try_store_in_db
>     session_data=cPickle.dumps(dict(self)),
>   File "/usr/lib/python2.5/copy_reg.py", line 69, in _reduce_ex
>     raise TypeError, "can't pickle %s objects" % base.__name__
> TypeError: can't pickle file objects
>
> Any ideas?
--~--~---------~--~----~------------~-------~--~----~
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