This is related to an old issue on whether form.vars.file when
db.table.file.type=='upload' should be a FieldStorage object of the
new filename. User Hamdy argued the latter and I the former in order
to keep backward compatibility.

You proved to us this is a bug because it breaks auth.

I now fixed it in trunk.

!!!! This will break the code of anybody who assumes form.vars.file is
a FieldStorage is a file object. For the solution is replace
form.vars.file  with request.vars.file

Massimo


Massimo

On May 24, 3:39 pm, mdipierro <[email protected]> wrote:
> May be a bug.  I will check.
>
> Massimo
>
> On May 24, 11:41 am, selecta <[email protected]> wrote:
>
> > I am trying to customize auth with
>
> > auth_table = db.define_table( auth.settings.table_user_name,
> >         Field('first_name', length=128, default='',requires =
> > IS_NOT_EMPTY(error_message=auth.messages.is_empty)),
> >         Field('last_name', length=128, default='',requires =
> > IS_NOT_EMPTY(error_message=auth.messages.is_empty)),
> >         Field('email', length=128, default='', unique=True,requires =
> > [ IS_EMAIL(error_message=auth.messages.invalid_email),
> > IS_NOT_IN_DB(db, auth.settings.table_user_name+".email")]),
> >         #Field('password', 'password', length=256, readable=False,
> > label='Password',requires = [IS_STRONG(), CRYPT()]),
> >         Field('password', 'password', length=256, readable=False,
> > label='Password',requires = CRYPT()),
> >         Field('registration_key', length=128, default= '',
> > writable=False, readable=False),
> >         Field('skype'),
> >         Field('tel', requires = IS_EMPTY_OR(IS_MATCH('^\+\d{2} \d+ \d+
> > $', error_message='telephone number format: +XX XX* XXXXXX*'))),
> >         Field('fax', requires = IS_EMPTY_OR(IS_MATCH('^\+\d{2} \d+ \d+
> > $', error_message='faxnumber number format: +XX XX* XXXXXX*'))),
> >         Field('avatar', 'upload', requires = IS_IMAGE(), label = "Your
> > Picture")
> >         )
>
> > but when I upload an image I get
>
> > Traceback (most recent call last):
> >   File "/home/select/Dev/web2py/gluon/main.py", line 407, in wsgibase
> >     session._try_store_on_disk(request, response)
> >   File "/home/select/Dev/web2py/gluon/globals.py", line 375, in
> > _try_store_on_disk
> >     cPickle.dump(dict(self), response.session_file)
> >   File "/usr/lib/python2.6/copy_reg.py", line 70, in _reduce_ex
> >     raise TypeError, "can't pickle %s objects" % base.__name__
> > TypeError: can't pickle file objects
>
> > I think I saw an answer for that some time ago, but I cannot find it
> > would it be possible to modify the session so it does not try to store
> > upload fields from auth?

Reply via email to