I'm having some trouble uploading/accessing a file on Google App Engine
(GAE).
This is the code used to store the file:
@request.restful()
def workspace():
def POST(*args,**vars):
workspace_id = db.workspace.insert(repository=request.vars.
repository,
name=request.vars.name,
file=db.workspace.file.store(
request.vars.file))
from gluon.serializers import json
return json(dict(workspace_id=workspace_id))
return locals
When I check the field in the Datastore viewer (file_blob) it returns "No
data was found".
When I change the above code to:
@request.restful()
def workspace():
def POST(*args,**vars):
workspace_id = db.workspace.insert(repository=request.vars.
repository,
name=request.vars.name,
file=db.workspace.file.store(
request.vars.file))
print '###############'
print db.workspace(workspace_id).file
print db.workspace.file.retrieve(db.workspace(workspace_id).file)
print '###############'
from gluon.serializers import json
return json(dict(workspace_id=workspace_id))
return locals
I get the following in the log:
###############
workspace.file.b575903eaa01af0a.6e6f6e65326e6f6e65202831292e666d77.fmw
6051711999279104
ERROR 2015-11-28 07:25:42,062 restricted.py:69] Unable to store in
FILE: /web2py/applications/init/controllers/workspace.py
Traceback (most recent call last):
File "/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/web2py/applications/init/controllers/workspace.py", line 214, in
<module>
File "/web2py/gluon/globals.py", line 412, in <lambda>
self._caller = lambda f: f()
File "/web2py/gluon/tools.py", line 3785, in f
return action(*a, **b)
File "/web2py/gluon/globals.py", line 378, in f
return rest_action(*_self.args, **getattr(_self, 'vars', {}))
File "/web2py/applications/init/controllers/workspace.py", line 128, in
POST
print db.workspace.file.retrieve(db.workspace(workspace_id).file)
File "/web2py/gluon/packages/dal/pydal/objects.py", line 1544, in retrieve
raise NotFoundException
NotFoundException
Any help is appreciated.
Cheers,
--
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.