At some point in time you changed

Field('word', 'reference words', ...)

to

Field('word', 'list:reference words', ...)

and you had data in the database. SQLite let you do that (because
SQLite does not check field type and does not support alter table), so
now you have corrupted data in the table and you cannot select it any
more.

You need do delete your database

   rm applications/app/databases/*

and start clean.


On Dec 23, 4:54 am, "Arun K.Rajeevan" <[email protected]> wrote:
> I've following in model
>
> db.define_table('languages',
>                 Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('full', 'string', 
> length=30, notnull=True, required=True),
>                 Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('short', 'string', 
> length=10 , notnull=True, required=True),
>                 format='%(full)s - %(short)s')
>
> db.define_table('words',
>                 Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('word', 'string', 
> notnull=True, required=True),
>                 Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('lang', db.languages, 
> notnull=True, readable=False, writable=False),
>                 Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('entry_by', db.auth_user, 
> notnull=True, readable=False, writable=False))
>
> db.define_table('pictures',
>                 Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('image', 'upload', 
> notnull=True, required=True, label='Visual Lingua'),
>                 Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('word', 'list:reference 
> words', readable=False, writable=False, required=True),
>                 Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('total', 'integer', 
> notnull=True, readable=False, writable=False, default=2),
>                 Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('clicks', 'integer', 
> notnull=True, readable=False, writable=False, default=1),
>                 Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('rating', 'double', 
> notnull=True, readable=False, writable=False, compute=lambda row: 
> row['total']/row['clicks']),
>                 Field 
> <http://127.0.0.1:8000/examples/global/vars/Field>('entry_by', db.auth_user, 
> notnull=True, readable=False, writable=False))
> '''
> db.define_table('symbolize',
>                 Field('image', db.pictures, notnull=True, readable=False, 
> writable=False, required=True ),
>                 Field('word', db.words, notnull=True, readable=False, 
> writable=False, required=True))
> '''              
>
> I got following error when I select table '*pictures*' on appadmin.
> Isn't that an error?
> Other table's pages are rendered correct.
>
> Version  web2py™ Version 1.91.4 (2010-12-22 17:31:23)  Python Python 2.5.1:
> C:\Python25\python.exe  Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
>
> Traceback (most recent call last):
>   File 
> "I:\Evolve\Work\web2py_src_downloaded\google_appengine\visuallingua\gluon\restricted.py",
>  line 188, in restricted
>     exec ccode in environment
>   File 
> "I:/Evolve/Work/web2py_src_downloaded/google_appengine/visuallingua/applications/init/views/appadmin.html"
>  <http://127.0.0.1:8000/admin/default/edit/init/views/appadmin.html>, line 
> 165, in <module>
>     <p>
>   File 
> "I:\Evolve\Work\web2py_src_downloaded\google_appengine\visuallingua\gluon\sqlhtml.py",
>  line 1329, in __init__
>     r = field.represent(r)
>   File 
> "I:\Evolve\Work\web2py_src_downloaded\google_appengine\visuallingua\gluon\dal.py",
>  line 3012, in list_ref_repr
>     return (ids and ', '.join(f(r,ref.id) for ref in refs) or '')
> TypeError: sequence item 0: expected string, int found
>
>  Error snapshot [image: help] Detailed traceback description
>
> <type 'exceptions.TypeError'>(sequence item 0: expected string, int found)
>
> Function argument list
>
> (ids=[2], r=<Table {'lang': <gluon.dal.Field object at 0x021...>, 'id':
> <gluon.dal.Field object at 0x021B8550>}>, f=<function ff at 0x021C4430>)
>  Code listing
>
> 3007.
> 3008.
> 3009.
> 3010.
> 3011.
> 3012.
>
> 3013.
> 3014.
> 3015.
> 3016.
>
>             field_type.find('.') < 0 and \
>             field_type[15:] in field.db.tables:
>         referenced = field.db[field_type[15:]]
>         def list_ref_repr(ids, r=referenced, f=ff):
>             refs = r._db(r.id.belongs(ids)).select(r.id)
>             return (ids and ', '.join(f(r,ref.id) for ref in refs) or '')
>
>         field.represent = list_ref_repr
>         if hasattr(referenced, '_format') and referenced._format:
>             requires = validators.IS_IN_DB(field.db,referenced.id,
>                                            referenced._format,multiple=True)
>
>  Variables ', '.join undefined  f <function ff at 0x021C4430>  refs 
> <gluon.dal.Rows
> object at 0x020A94D0>  ids [2]  r <Table {'lang': <gluon.dal.Field object at
> 0x021...>, 'id': <gluon.dal.Field object at 0x021B8550>}>  ref undefined

Reply via email to