Hello Eric,

I would help, but I have no clue...

Do you alternate between SQLite and Postgres? If yes, web2py always try to
recreate the auth(s) tables that is a problem I often have... To solve it
you must define the auth(s) tables in the db.py and set them to
migrate=false... so web2py stop to trigger their creation each time...

Richard

On Thu, Aug 25, 2011 at 1:53 PM, Eric Scott <[email protected]>wrote:

> I'm using postgresql.  I had to change a field name in my table def,
> which are in the web2py models.  The database changed accordingly, but
> now I get a key error when I try to insert a new record using
> appadmin.  I made sure appadmin.py is the latest and greatest.  Still
> getting key error.  I don't dare drop the db since each time I've done
> that before I've not been able to get it running again, no matter how
> many variations of migrate and fake_migrate I tried.  So end up having
> to re-create the app, and then copy in the files, which takes a long
> time.
>
> I love web2py but database issues are driving me nuts.  Can someone
> please help me?  My app is so close to finished.
>
> Here's the traceback
>
> Traceback (most recent call last):
>  File "/home/www-data/web2py/gluon/restricted.py", line 192, in
> restricted
>    exec ccode in environment
>  File "/home/www-data/web2py/applications/baristacode/controllers/
> appadmin.py", line 411, in <module>
>  File "/home/www-data/web2py/gluon/globals.py", line 145, in <lambda>
>    self._caller = lambda f: f()
>  File "/home/www-data/web2py/applications/baristacode/controllers/
> appadmin.py", line 126, in insert
>    form = SQLFORM(db[table], ignore_rw=ignore_rw)
>  File "/home/www-data/web2py/gluon/sqlhtml.py", line 830, in __init__
>    inp = self.widgets.options.widget(field, default)
>  File "/home/www-data/web2py/gluon/sqlhtml.py", line 218, in widget
>    options = requires[0].options()
>  File "/home/www-data/web2py/gluon/validators.py", line 438, in
> options
>    self.build_set()
>  File "/home/www-data/web2py/gluon/validators.py", line 421, in
> build_set
>    fields = [self.dbset.db[self.ktable][k] for k in self.fields]
>  File "/home/www-data/web2py/gluon/dal.py", line 4675, in __getitem__
>    return dict.__getitem__(self, str(key))
> KeyError: 'name_string'
>
>
> By the way, I changed the field name from "name_string" to "name".
> Somewhere, "name_string" is still cached.  I just can't figure out
> where.  I've cleared the caches, restarted, etc etc.
>
> Thanks in advance for your help.
>
> Eric

Reply via email to