hi,
is it possible to temporary store the uploaded file in session?
e.g.
import os
def form_1(session_order, link_form, link_checkout):
form = SQLFORM.factory(
Field('detail_account', 'reference detail_account',
requires = IS_IN_DB(current.db,
current.db.detail_account.id, current.db.detail_account._format,
orderby = current.db.detail_account.name) ),
Field('amount', 'integer', requires = IS_NOT_EMPTY() ),
* Field('cash_out_document', 'upload', requires = IS_NOT_EMPTY(), *
* uploadfolder = os.path.join(current.request.folder, 'static',
'temp_document') ),*
)
if form.process().accepted:
current.response.flash = current.T('Form accepted')
id = int(current.request.vars.detail_account)
amount = int(current.request.vars.amount)
* cash_out_document = current.request.vars.cash_out_document*
* session_order[id] = amount, cash_out_document*
redirect(URL(link_form) )
elif form.errors:
current.response.flash = current.T('Form has errors')
return dict(form = form, link_checkout = link_checkout)
what i want to achieve is to store one or many document in the session,
after checkout and confirm all is complete it will insert into database and
clear the session. is it possible to achieve it using web2py way?
when i tried it return an error :
Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Traceback (most recent call last):
File "/Users/MacBookPro/site/web2py/gluon/main.py", line 480, in wsgibase
session._try_store_in_cookie_or_file(request, response)
File "/Users/MacBookPro/site/web2py/gluon/globals.py", line 1181, in
_try_store_in_cookie_or_file
return self._try_store_in_file(request, response)
File "/Users/MacBookPro/site/web2py/gluon/globals.py", line 1188, in
_try_store_in_file
or self._unchanged(response)):
File "/Users/MacBookPro/site/web2py/gluon/globals.py", line 1133, in
_unchanged
session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
TypeError: expected string or Unicode object, NoneType found
thanks and best regards,
stifan
--
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.