I did an update of trunk using hg and copied dal.py over sql.py in gluon and start the web2py.py server and still get
Traceback (most recent call last): File "/home/camcentral/Dev/web2py_hg/gluon/main.py", line 446, in wsgibase BaseAdapter.close_all_instances(BaseAdapter.commit) File "/home/camcentral/Dev/web2py_hg/gluon/sql.py", line 276, in close_all_instances self.connection.close() NameError: global name 'self' is not defined main is calling BaseAdapter.close_all_instances() as a class method so the self reference at line 276 blows up because there is no instance of a class. I see from the latest post we can test dal.py standalone, are we not to be testing as part of web2py yet because of integration issues? Ron On Dec 5, 7:11 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > started work integrating with gluon/contrib/gql.py do > > please keep testing dal.py > > now it no longer requires web2py and you can do > > % python>>> from dal import DAL, Field > >>> db=DAL('sqlite://file.sqlite') > >>> db.define_table('person',Field('name')) > > etc etc. > > you ONLY need dal.py > > On Dec 5, 1:56 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > in trunk! > > > On Dec 5, 1:38 pm, "mr.freeze" <nat...@freezable.com> wrote: > > > > Auth.define_tables doesn't have a fake_migrate attribute so I added > > > one (want a patch?). Once I did, my .table files were re-created when > > > migrate=True and fake_migrate=True. It still works once I set > > > fake_migrate to False. I will test it against the new DAL now. > > > > On Dec 5, 1:24 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > can you try migrate=True, fake_migrate=True? > > > > > On Dec 5, 1:05 pm, "mr.freeze" <nat...@freezable.com> wrote: > > > > > > I tried and the file modification times of the .table files do not > > > > > change. I deleted them (safely backed up) and they are not re-created. > > > > > > On Dec 5, 12:56 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > > > It is the same. try without delete them. > > > > > > > On Dec 5, 12:53 pm, "mr.freeze" <nat...@freezable.com> wrote: > > > > > > > > I reverted to the old DAL and did the steps you outlined. Same > > > > > > > result. > > > > > > > Should I delete the .table files first? > > > > > > > > On Dec 5, 12:41 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > > > > > for the troublesome table (auth_user) set migrate=False, > > > > > > > > fake_migrate=True reload, then migrate=True and remove > > > > > > > > fake_migrate. > > > > > > > > It should fix your broken .table. > > > > > > > > > Should work with old and with new dal. > > > > > > > > > On Dec 5, 11:47 am, "mr.freeze" <nat...@freezable.com> wrote: > > > > > > > > > > I seem to remember this failing before though. Something about > > > > > > > > > my .TABLE files being out of sync. What is the procedure to > > > > > > > > > re-sync > > > > > > > > > them? > > > > > > > > > > On Dec 5, 10:45 am, "mr.freeze" <nat...@freezable.com> wrote: > > > > > > > > > > > I have a global variable migrate_db which is passed to all > > > > > > > > > > define_table functions. I switched it to false and get this: > > > > > > > > > > Traceback (most recent call last): > > > > > > > > > > File "C:\web2py\gluon\restricted.py", line 188, in > > > > > > > > > > restricted > > > > > > > > > > exec ccode in environment > > > > > > > > > > File "C:/web2py/applications/main/models/db.py", line 34, > > > > > > > > > > in > > > > > > > > > <module> > > > > > > > > > > readable=False, default=""),migrate=migrate_db) > > > > > > > > > > File "C:\web2py\gluon\sql.py", line 1406, in define_table > > > > > > > > > > obj = str(obj) > > > > > > > > > > File "C:\web2py\gluon\sql.py", line 1858, in _create > > > > > > > > > > 'boolean': 'CHAR(1)', > > > > > > > > > > File "C:\web2py\gluon\sql.py", line 1024, in <lambda> > > > > > > > > > > 'string': 'CHAR(%(length)s)', > > > > > > > > > > File "C:\Python26\lib\site-packages\MySQLdb\cursors.py", > > > > > > > > > > line 166, > > > > > > > > > > in execute > > > > > > > > > > self.errorhandler(self, exc, value) > > > > > > > > > > File > > > > > > > > > > "C:\Python26\lib\site-packages\MySQLdb\connections.py", line > > > > > > > > > > 35, in defaulterrorhandler > > > > > > > > > > raise errorclass, errorvalue > > > > > > > > > > OperationalError: (1050, "Table 'auth_user' already exists") > > > > > > > > > > > On Dec 5, 10:37 am, "mr.freeze" <nat...@freezable.com> > > > > > > > > > > wrote: > > > > > > > > > > > > Let me backup the web2pyslice.com database and I will try. > > > > > > > > > > > > On Dec 5, 10:36 am, mdipierro <mdipie...@cs.depaul.edu> > > > > > > > > > > > wrote: > > > > > > > > > > > > > can you try migrate=True (add a dummy field and the > > > > > > > > > > > > remove it) with > > > > > > > > > > > > mysql? > > > > > > > > > > > > > On Dec 5, 10:20 am, "mr.freeze" <nat...@freezable.com> > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > Working with mysql also. I tested with migrate=False. > > > > > > > > > > > > > Nice work! > > > > > > > > > > > > > > On Dec 5, 10:12 am, "mr.freeze" > > > > > > > > > > > > > <nat...@freezable.com> wrote: > > > > > > > > > > > > > > > Okay, web2pyslices.com source runs against it with > > > > > > > > > > > > > > a sqlite database. > > > > > > > > > > > > > > I will test with mysql. > > > > > > > > > > > > > > > On Dec 4, 11:02 pm, mdipierro > > > > > > > > > > > > > > <mdipie...@cs.depaul.edu> wrote: > > > > > > > > > > > > > > > > One more test please. I do not have mysql > > > > > > > > > > > > > > > installed here so I did not > > > > > > > > > > > > > > > test pooling. This helps a lot. thanks. > > > > > > > > > > > > > > > > On Dec 4, 10:33 pm, "mr.freeze" > > > > > > > > > > > > > > > <nat...@freezable.com> wrote: > > > > > > > > > > > > > > > > > Looking closer, there is a syntax error on line > > > > > > > > > > > > > > > > 189: COnnectionPool > > > > > > > > > > > > > > > > After I fixed that, I get: > > > > > > > > > > > > > > > > Traceback (most recent call last): > > > > > > > > > > > > > > > > File "C:\web2py\gluon\main.py", line 488, in > > > > > > > > > > > > > > > > wsgibase > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > BaseAdapter.close_all_instances(BaseAdapter.rollback) > > > > > > > > > > > > > > > > File "C:\web2py\gluon\sql.py", line 163, in > > > > > > > > > > > > > > > > close_all_instances > > > > > > > > > > > > > > > > pool = ConnectionPool._pools[instance._uri] > > > > > > > > > > > > > > > > AttributeError: 'SQLiteAdapter' object has no > > > > > > > > > > > > > > > > attribute '_uri' > > > > > > > > > > > > > > > > > On Dec 4, 10:26 pm, "mr.freeze" > > > > > > > > > > > > > > > > <nat...@freezable.com> wrote: > > > > > > > > > > > > > > > > > > I get this now: > > > > > > > > > > > > > > > > > Traceback (most recent call last): > > > > > > > > > > > > > > > > > File "C:\web2py\gluon\restricted.py", line > > > > > > > > > > > > > > > > > 188, in restricted > > > > > > > > > > > > > > > > > exec ccode in environment > > > > > > > > > > > > > > > > > File > > > > > > > > > > > > > > > > > "C:/web2py/applications/main/models/db.py", > > > > > > > > > > > > > > > > > line 22, in > > > > > > > > > > > > > > > > > <module> > > > > > > > > > > > > > > > > > db = SQLDB(dal_connection,pool_size=10) > > > > > > > > > > > > > > > > > File "C:\web2py\gluon\sql.py", line 2405, > > > > > > > > > > > > > > > > > in __init__ > > > > > > > > > > > > > > > > > raise RuntimeError, "Failure to connect, > > > > > > > > > > > > > > > > > tried 5 times" > > > > > > > > > > > > > > > > > RuntimeError: Failure to connect, tried 5 > > > > > > > > > > > > > > > > > times > > > > > > > > > > > > > > > > > > On Dec 4, 9:57 pm, mdipierro > > > > > > > > > > > > > > > > > <mdipie...@cs.depaul.edu> wrote: > > > > > > > > > > > > > > > > > > > Can you try delete everything in app/cache/ > > > > > > > > > > > > > > > > > > > The error seems in opening the cache file. > > > > > > > > > > > > > > > > > > > On Dec 4, 8:30 pm, "mr.freeze" > > > > > > > > > > > > > > > > > > <nat...@freezable.com> wrote: > > > > > > > > > > > > > > > > > > > > I was getting that error. After updating > > > > > > > > > > > > > > > > > > > it goes away but now I get > > > > > > > > > > > > > > > > > > > the below. I am running it against > > > > > > > > > > > > > > > > > > > web2pyslices.com source on a sqlite > > > > > > > > > > > > > > > > > > > db with Python 2.5: > > > > > > > > > > > > > > > > > > > > Traceback (most recent call last): > > > > > > > > > > > > > > > > > > > File > > > > > > > > > > > > > > > > > > > "C:\Users\nathan\workspace\web2py\gluon\restricted.py", > > > > > > > > > > > > > > > > > > > line > > > > > > > > > > > > > > > > > > > 188, in restricted > > > > > > > > > > > > > > > > > > > exec ccode in environment > > > > > > > > > > > > > > > > > > > File > > > > > > > > > > > > > > > > > > > "C:/Users/nathan/workspace/web2py/applications/main/models/ > > > > > > > > > > > > > > > > > > > menu.py", line 115, in <module> > > > > > > > > > > > > > > > > > > > response.tagcloud = > > > > > > > > > > > > > > > > > > > db().select(db.tags.ALL,orderby=~db.tags.count,limitby=(0,15),cache=(cache.disk, > > > > > > > > > > > > > > > > > > > 600)) > > > > > > > > > > > > > > > > > > > File > > > > > > > > > > > > > > > > > > > "C:\Users\nathan\workspace\web2py\gluon\sql.py", > > > > > > > > > > > > > > > > > > > line 3319, in > > > > > > > > > > > > > > > > > > > select > > > > > > > > > > > > > > > > > > > shutil.copyfileobj(file, dest_file) > > > > > > > > > > > > > > > > > > > File > > > > > > > > > > > > > > > > > > > "C:\Users\nathan\workspace\web2py\gluon\cache.py", > > > > > > > > > > > > > > > > > > > line 282, in > > > > > > > > > > > > > > > > > > > __call__ > > > > > > > > > > > > > > > > > > > storage = > > > > > > > > > > > > > > > > > > > shelve.open(self.shelve_name) > > > > > > > > > > > > > > > > > > > File "C:\Python25\lib\shelve.py", line > > > > > > > > > > > > > > > > > > > 225, in open > > > > > > > > > > > > > > > > > > > return DbfilenameShelf(filename, > > > > > > > > > > > > > > > > > > > flag, protocol, writeback) > > > > > > > > > > > > > > > > > > > File "C:\Python25\lib\shelve.py", line > > > > > > > > > > > > > > > > > > > 209, in __init__ > > > > > > > > > > > > > > > > > > > Shelf.__init__(self, > > > > > > > > > > > > > > > > > > > anydbm.open(filename, flag), protocol, > > > > > > > > > > > > > > > > > > > writeback) > > > > > > > > > > > > > > > > > > > File "C:\Python25\lib\anydbm.py", line > > > > > > > > > > > > > > > > > > > 83, in open > > > > > > > > > > > > > > > > > > > return mod.open(file, flag, mode) > > > > > > > > > > > > > > > > > > > File "C:\Python25\lib\dbhash.py", line > > > > > > > > > > > > > > > > > > > 16, in open > > > > > > > > > > > > > > > > > > > return bsddb.hashopen(file, flag, > > > > > > > > > > > > > > > > > > > mode) > > > > > > > > > > > > > > > > > > > File > > > > > > > > > > > > > > > > > > > "C:\Python25\lib\bsddb\__init__.py", line > > > > > > > > > > > > > > > > > > > 310, in hashopen > > > > > > > > > > > > > > > > > > > d.open(file, db.DB_HASH, flags, mode) > > > > > > > > > > > > > > > > > > > DBPermissionsError: (1, 'Operation not > > > > > > > > > > > > > > > > > > > permitted') > > > > > > > > > > > > > > > > > > > > On Dec 4, 4:00 pm, mdipierro > > > > > > > > > > > > > > > > > > > <mdipie...@cs.depaul.edu> wrote: > > > > > > > > > > > > > > > > > > > > > can you please try again? > > > > > > > > > > > > > > > > > > > > > Massimo > > > > > > > > > > > > > > > > > > > > > On Dec 4, 12:31 pm, ron_m > > > > > > > > > > > > > > > > > > > > <ron.mco...@gmail.com> wrote: > > > > > > > > > > > > > > > > > > > > > > Describe what I did > > > > > > > > > > > > > > > > > > > > > > Copied the trunk hg area to a work > > > > > > > > > > > > > > > > > > > > > area > > > > > > > > > > > > > > > > > > > > > Renamed sql.py to sql-save.py > > > > > > > > > > > > > > > > > > > > > Copied dal.py to sql.py in order to > > > > > > > > > > > > > > > > > > > > > replace sql.py with dal.py > > > > > > > > > > > > > > > > > > > > > Copied application I am working on to > > > > > > > > > > > > > > > > > > > > > applications directory > > > > > > > > > > > > > > > > > > > > > Backed up the database > > > > > > > > > > > > > > > > > > > > > Ran the server as python web2py.py > > > > > > > > > > > > > > > > > > > > > > Got this > > ... > > read more »