Hello,

i work with Web2Py on GAE. I try to make a db.insert with
SQLFORM.factory method.

def test():
    form = SQLFORM.factory( Field('logo','upload'))
    if form.accepts(request.vars, session):
        new_domain = db.domain.insert(logo = request.vars.logo)
        response.flash='cool'
    elif form.errors:
        response.flash='error'
    else :
        response.flash='fill the form'
    return dict(form=form)

I raise an error because GAE forbidden to write file.

(dp0
S'output'
p1
S''
p2
sS'layer'
p3
S'c:\\dev\\place-1901-random\\applications\\init/controllers/
default.py'
p4
sS'code'
p5
S'<code object <module> at 031BFBA8, file "c:\\dev\\place-1901-random\
\applications\\init/controllers/default.py:test", line 11>'
p6
sS'traceback'
p7
S'Traceback (most recent call last):\n  File "c:\\dev\\place-1901-
random\\gluon\\restricted.py", line 178, in restricted\n    exec ccode
in environment\n  File "c:\\dev\\place-1901-random\\applications\\init/
controllers/default.py:test", line 165, in <module>\n  File "c:\\dev\
\place-1901-random\\gluon\\globals.py", line 96, in <lambda>\n
self._caller = lambda f: f()\n  File "c:\\dev\\place-1901-random\
\applications\\init/controllers/default.py:test", line 133, in test\n
File "c:\\dev\\place-1901-random\\gluon\\sqlhtml.py", line 959, in
accepts\n    newfilename = field.store(source_file, original_filename)
\n  File "c:\\dev\\place-1901-random\\gluon\\sql.py", line 2693, in
store\n    dest_file = open(pathfilename, \'wb\')\n  File "C:\\dev\
\gae134\\google\\appengine\\tools\\dev_appserver.py", line 1200, in
__init__\n    raise IOError(\'invalid mode: %s\' % mode)\nIOError:
invalid mode: wb\n'
p8


I think is normal but I have no idea for get around this problem.

Thanks.

Reply via email to