I think this is fixed in trunk, although fixing this may be a backward 
compatibility issues.

When web2py uploads a file (in you case in field picture) the new file name 
is stored in both

form.vars.picture
form.vars.picture_newfilename (for backward compatibility)

I see the latter is problematic and nobody is probably using it anyway. I 
am removing unless there is a major complaint. It could be treated as a bug.

massimo


On Tuesday, 7 August 2012 12:34:16 UTC-5, Paolo wrote:
>
> Hi all, 
> I've just checked out the last trunk, I got the following error:
>
> 2012-08-07 19:26:01,063 - web2py - ERROR - Traceback (most recent call 
> last):
>   File "/home/paolo/Desktop/git/web2py/gluon/restricted.py", line 205, in 
> restricted
>     exec ccode in environment
>   File 
> "/home/paolo/Dropbox/git/web2py/applications/bikend/controllers/club.py", 
> line 125, in <module>
>   File "/home/paolo/Desktop/git/web2py/gluon/globals.py", line 182, in 
> <lambda>
>     self._caller = lambda f: f()
>   File "/home/paolo/Desktop/git/web2py/gluon/tools.py", line 2722, in f
>     return call_or_redirect(
>   File 
> "/home/paolo/Dropbox/git/web2py/applications/bikend/controllers/club.py", 
> line 37, in item
>     m = modal()
>   File "/home/paolo/Desktop/git/web2py/gluon/tools.py", line 2722, in f
>     return call_or_redirect(
>   File 
> "/home/paolo/Dropbox/git/web2py/applications/bikend/controllers/club.py", 
> line 57, in modal
>     d['form'] = club_form()
>   File 
> "/home/paolo/Dropbox/git/web2py/applications/bikend/controllers/club.py", 
> line 104, in club_form
>     form.vars.id = db.club.insert(**dict(form.vars))
>   File "/home/paolo/Desktop/git/web2py/gluon/dal.py", line 7514, in insert
>   File "/home/paolo/Desktop/git/web2py/gluon/dal.py", line 7475, in 
> _listify
>     if name != 'id':
> SyntaxError: Field picture_newfilename does not belong to the table
>
> The tables involved are defined as follows:
>
> pictures_fields = db.Table(db, 'picture',
>     Field('picture_desc', 'text', requires=[IS_TRIM(), 
> IS_LENGTH(140,error_message=T('Warning, description too long'))]),
>     Field("picture", "upload", autodelete=True, requires=[IS_NOT_EMPTY(), 
> IS_IMAGE(), 
> IS_UPLOAD_FILENAME(extension='jpg|jpeg|png'),IS_IMAGE(extensions=('jpeg', 
> 'png'))]),
>     Field("normal", "upload", autodelete=True, requires=[IS_IMAGE()]),
>     Field("thumbnail", "upload", autodelete=True, requires=[IS_IMAGE()]),
> )
> pictures_fields.thumbnail.compute = lambda row: THUMBER(row.picture, 200, 
> 200, name='thumb') 
> pictures_fields.normal.compute = lambda row: THUMBER(row.picture, 600, 
> 600, name='normal') 
> pictures_fields.picture_desc.label = T('Picture description')
>
>
> db.define_table('club',
>     Field('title', 'string', requires=[IS_TRIM(), 
> IS_LENGTH(150,error_message=T('Warning, title too long'))]),
>     Field('description', 'text', 
> requires=[IS_NOT_EMPTY(error_message=T('Please, enter a description')),
>                                            
> IS_LENGTH(250,error_message=T('Warning, description too long')), 
>                                            IS_LENGTH(minsize=75, 
> error_message=T('Warning, the description is too short, reviews must be at 
> least 75 characters long.')),
>                                            IS_TRIM()]),
>     Field("type", requires=IS_IN_SET(['cerco', 'offro']), default='offro'),
>     Field("location", 'string'),
>     pictures_fields,
>     auth.signature
> )
> db.club.picture.requires = IS_EMPTY_OR(db.club.picture.requires)
> db.club.picture_desc.readable = False
> db.club.picture_desc.writable = False
> db.club._common_filter = lambda query: (db.club.is_active==True)
>
> What could be the problem?
>
> Regards,
> paolo
>

-- 



Reply via email to