Hello,

I am getting this :

Traceback (most recent call last):
  File "/web2py/web2py/gluon/restricted.py", line 188, in restricted
    exec ccode in environment
  File "/web2py/web2py/applications/image/controllers/appadmin.py",
line 410, in <module>
  File "/web2py/web2py/gluon/globals.py", line 96, in <lambda>
    self._caller = lambda f: f()
  File "/web2py/web2py/applications/image/controllers/appadmin.py",
line 273, in update
    f='download', args=request.args[:1]))
  File "/web2py/web2py/gluon/sqlhtml.py", line 759, in __init__
    inp = self.widgets.upload.widget(field, default, upload)
  File "/web2py/web2py/gluon/sqlhtml.py", line 400, in widget
    url = download_url + '/' + value
TypeError: cannot concatenate 'str' and 'buffer' objects


Here are my model and controler :


db.define_table('image2',

    Field('image2_id','id'),

    Field('titre','string'),

    Field('image_filename'),

    Field('image','upload',uploadfield=True),

    format='%(titre)s',

    sequence_name='image2_image2_id_seq')



def display_form():

    #record = db.image2(request.args(0)) or redirect(URL('index'))

    url = URL('download')

    form = SQLFORM(db.image2, deletable=True,

                   upload=url, fields=['titre', 'image'])

    if request.vars.image:

        form.vars.image_filename = request.vars.image.filename

    if form.accepts(request.vars, session):

        response.flash = 'form accepted'

    elif form.errors:

        response.flash = 'form has errors'

    return dict(form=form)


def download():

    return response.download(request, db)





I change to bytea "image" field manually at postgres level.


web2py Version 1.85.3 (2010-09-18 07:07:46)


it's like if  :

"if request.vars.image:

        form.vars.image_filename = request.vars.image.filename"

was not working...

Thanks


Richard

Reply via email to