this was a bug and was fixed in 1.83.2. please check it. Massimo
On Aug 17, 3:24 am, Karan Poddar <karan.pod...@gmail.com> wrote: > import datetime; now=datetime.datetime.today() > > db.define_table('Genre', > SQLField('Name','string')) > > db.Genre.Name.requires=IS_NOT_IN_DB(db,'Genre.Name') > > db.define_table('Songs', > SQLField('Name','string',requires=IS_NOT_EMPTY()), > SQLField('file','upload',requires=IS_NOT_EMPTY()), > SQLField('date','datetime'), > > SQLField('download','integer',default=0,readable=False,writable=False), > SQLField('genre',db.Genre), > SQLField('usr',db.auth_user), > > SQLField('album','string',default='Unknown',requires=IS_NOT_EMPTY()), > > SQLField('artist','string',default='Unknown',requires=IS_NOT_EMPTY()), > > SQLField('rating','double',default=0,readable=False,writable=False), > > SQLField('rater','integer',default=0,readable=False,writable=False), > > SQLField('play','integer',default=0,readable=False,writable=False)) > > db.Songs.genre.requires=IS_IN_DB(db,'Genre.id','%(Name)s') > db.Songs.usr.requires=IS_IN_DB(db,'auth_user.id','%(first_name)s') > db.Songs.date.default=now > db.Songs.date.readable=False > db.Songs.date.writable=False > i hav created the above table which doesn't shows any error until i > put a data in db.Songs.After inserting the data,if i go to database > administration n open db.Songs,it shows: > Error traceback > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8. > 9. > 10. > 11. > 12. > 13. > > Traceback (most recent call last): > File "/home/karan/Desktop/web2py/gluon/restricted.py", line 186, in > restricted > exec ccode in environment > File "/home/karan/Desktop/web2py/applications/Music_Library/views/ > appadmin.html", line 160, in <module> > <strong>{{="%02d" % ram['oldest'][0]}}</strong> hours > File "/home/karan/Desktop/web2py/gluon/sqlhtml.py", line 1175, in > __init__ > r = field.represent(r) > File "/home/karan/Desktop/web2py/gluon/sql.py", line 498, in > <lambda> > field.represent = lambda id, r=referenced, f=ff: f(r,id) > File "/home/karan/Desktop/web2py/gluon/sql.py", line 472, in ff > return r._format(row) > TypeError: 'NoneType' object is not callable > > Error snapshot > Detailed traceback description > > * Exception: <type 'exceptions.TypeError'>('NoneType' object is > not callable) > Exception instance attributes > o __setattr__: <method-wrapper '__setattr__' of > exceptions.TypeError object> > o __reduce_ex__: <built-in method __reduce_ex__ of > exceptions.TypeError object> > o __getslice__: <method-wrapper '__getslice__' of > exceptions.TypeError object> > o __getitem__: <method-wrapper '__getitem__' of > exceptions.TypeError object> > o __setstate__: <built-in method __setstate__ of > exceptions.TypeError object> > o __getattribute__: <method-wrapper '__getattribute__' of > exceptions.TypeError object> > o __str__: <method-wrapper '__str__' of exceptions.TypeError > object> > o args: ("'NoneType' object is not callable",) > o __reduce__: <built-in method __reduce__ of > exceptions.TypeError object> > o __format__: <built-in method __format__ of > exceptions.TypeError object> > o __class__: <type 'exceptions.TypeError'> > o __dict__: {} > o __delattr__: <method-wrapper '__delattr__' of > exceptions.TypeError object> > o __subclasshook__: <built-in method __subclasshook__ of > type object> > o __repr__: <method-wrapper '__repr__' of > exceptions.TypeError object> > o __init__: <method-wrapper '__init__' of > exceptions.TypeError object> > o __hash__: <method-wrapper '__hash__' of > exceptions.TypeError object> > o __sizeof__: <built-in method __sizeof__ of > exceptions.TypeError object> > o __doc__: 'Inappropriate argument type.' > o __unicode__: <built-in method __unicode__ of > exceptions.TypeError object> > o __new__: <built-in method __new__ of type object> > * Python 2.6.5: /usr/bin/python > > File /home/karan/Desktop/web2py/gluon/restricted.py in restricted at > line 186 > [ code | arguments | variables ] > Function argument list: (code='response.write(\'<!DOCTYPE html PUBLIC > "-//W3C//D...n </div>\\n </body>\\n</html>\\n\', escape=False)', > environment={'A': <class 'gluon.html.A'>, 'Auth': <class > 'gluon.tools.Auth'>, 'B': <class 'gluon.html.B'>, 'BEAUTIFY': <class > 'gluon.html.BEAUTIFY'>, 'BODY': <class 'gluon.html.BODY'>, 'BR': > <class 'gluon.html.BR'>, 'CENTER': <class 'gluon.html.CENTER'>, > 'CLEANUP': <class 'gluon.validators.CLEANUP'>, 'CODE': <class > 'gluon.html.CODE'>, 'CRYPT': <class 'gluon.validators.CRYPT'>, ...}, > layer='/home/karan/Desktop/web2py/applications/Music_Library/views/ > appadmin.html') > > 181. > 182. > 183. > 184. > 185. > 186. > > 187. > 188. > 189. > 190. > > if type(code) == types.CodeType: > ccode = code > else: > ccode = compile2(code,layer) > > exec ccode in environment > > except HTTP: > raise > except Exception: > # XXX Show exception in Wing IDE if running in debugger > > * environment: {'A': <class 'gluon.html.A'>, 'Auth': <class > 'gluon.tools.Auth'>, 'B': <class 'gluon.html.B'>, 'BEAUTIFY': <class > 'gluon.html.BEAUTIFY'>, 'BODY': <class 'gluon.html.BODY'>, 'BR': > <class 'gluon.html.BR'>, 'CENTER': <class 'gluon.html.CENTER'>, > 'CLEANUP': <class 'gluon.validators.CLEANUP'>, 'CODE': <class > 'gluon.html.CODE'>, 'CRYPT': <class 'gluon.validators.CRYPT'>, ...} > * ccode: <code object <module> at 0x4057eb8, file "/home/...tions/ > Music_Library/views/appadmin.html", line 1> > > File /home/karan/Desktop/web2py/applications/Music_Library/views/ > appadmin.html in <module> at line 160 > [ code | arguments | variables ] > Function argument list: () > > 151. > 152. > 153. > 154. > 155. > 156. > 157. > 158. > 159. > 160. > > 161. > 162. > 163. > 164. > 165. > 166. > 167. > 168. > 169. > 170. > > response.write(' ]', escape=False) > pass > response.write(' \n ', escape=False) > if rows: > response.write('\n <div style="overflow: auto;" > width="80%">\n ', escape=False) > linkto=URL(r=request,f='update',args=request.args[0]) > response.write('\n ', escape=False) > upload=URL(r=request,f='download',args=request.args[0]) > response.write(' \n ', escape=False) > response.write(SQLTABLE(rows,linkto,upload,orderby=True,_class='sortable')) > > response.write('\n </div>\n ', escape=False) > pass > response.write('\n <br/><br/><h2>', escape=False) > response.write(T("Import/Export")) > response.write('</h2><br/>\n [ <a href="', escape=False) > > response.write(URL(r=request,f='csv',args=request.args[0],vars=dict(query=query))) > response.write('">', escape=False) > response.write(T("export as csv file")) > response.write('</a> ]\n ', escape=False) > if table: > > * hours: undefined > * strong: undefined > * ram: undefined > > File /home/karan/Desktop/web2py/gluon/sqlhtml.py in __init__ at line > 1175 > [ code | arguments | variables ] > Function argument list: (self=<gluon.sqlhtml.SQLTABLE object>, > sqlrows=<gluon.sql.Rows object>, linkto='/Music_Library/appadmin/ > update/db', upload='/Music_Library/appadmin/download/db', > orderby=True, headers={}, truncate=16, columns=['Songs.id', > 'Songs.Name', 'Songs.file', 'Songs.date', 'Songs.download', > 'Songs.genre', 'Songs.usr', 'Songs.album', 'Songs.artist', > 'Songs.rating', 'Songs.rater', 'Songs.play'], th_link='', > **attributes={'_class': 'sortable'}) > > 1170. > 1171. > 1172. > 1173. > 1174. > 1175. > > 1176. > 1177. > 1178. > 1179. > > r = record[fieldname] > else: > raise SyntaxError, 'something wrong in Rows > object' > r_old = r > if field.represent: > r = field.represent(r) > > elif field.type == 'blob' and r: > r = 'DATA' > elif field.type == 'upload': > if upload and r: > > * field: <gluon.sql.Field object> > * r: 1 > * field.represent: <function <lambda>> > > File /home/karan/Desktop/web2py/gluon/sql.py in <lambda> at line 498 > [ code | arguments | variables ] > Function argument list: (id=1, r=<Table {'ALL': <gluon.sql.SQLALL > object at 0x406...[], 'id': <gluon.sql.Field object at 0x4066310>}>, > f=<function ff>) > > 493. > 494. > 495. > 496. > 497. > 498. > > 499. > 500. > 501. > 502. > > requires.append(validators.IS_DATETIME()) > elif field._db and field_type.startswith('reference') and \ > field_type.find('.')<0 and \ > field_type[10:] in field._db.tables: > referenced = field._db[field_type[10:]] > field.represent = lambda id, r=referenced, f=ff: f(r,id) > > if hasattr(referenced,'_format') and referenced._format: > requires = validators.IS_IN_DB(field._db,referenced.id, > referenced._format) > if field.unique: > > * referenced: undefined > * f: <function ff> > * field: undefined > * r: <Table {'ALL': <gluon.sql.SQLALL object at 0x406...[], 'id': > <gluon.sql.Field object at 0x4066310>}> > * ff: undefined > * id: 1 > > File /home/karan/Desktop/web2py/gluon/sql.py in ff at line 472 > [ code | arguments | variables ] > Function argument list: (r=<Table {'ALL': <gluon.sql.SQLALL object at > 0x406...[], 'id': <gluon.sql.Field object at 0x4066310>}>, id=1) > > 467. > 468. > 469. > 470. > 471. > 472. > > 473. > 474. > 475. > 476. > > if not row: > return id > elif hasattr(r,'_format') and isinstance(r._format,str): > return r._format % row > elif hasattr(r,'_format'): > return r._format(row) > > else: > return id > > if field_type == 'string': > > * r: <Table {'ALL': <gluon.sql.SQLALL object at 0x406...[], 'id': > <gluon.sql.Field object at 0x4066310>}> > * r._format: None > * row: <Row {'update_record': <function <lambda> at 0x4...>, > 'Songs': <gluon.sql.Set object at 0x3d5f590>}> > > Moreover,it is giving some other error msg on a ubuntu 10.04 > 32bit(mine is 64bit). > plz help