from ft8.turboLink.help.HelpDatabaseModel import *
Catwalk can read the fact that there are tables in the SQL database
corresponding to the objects, but it cannot read the values in the
table. Instead, it spits out the following error:
2006-05-18 13:27:56,956 turbogears.identity INFO Identity is
available...
2006-05-18 13:27:56,971 cherrypy.msg INFO HTTP: Page handler: <bound
method Brow
se.index of <turbogears.toolbox.catwalk.browse.Browse object at
0x012F3AD0>>
Traceback (most recent call last):
File
"c:\python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg\cherrypy\_cphttpt
ools.py", line 105, in _run
self.main()
File
"c:\python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg\cherrypy\_cphttpt
ools.py", line 254, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in index
File
"c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\cont
rollers.py", line 273, in expose
output = database.run_with_transaction(
File
"c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\data
base.py", line 221, in run_with_transaction
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File
"c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\cont
rollers.py", line 290, in <lambda>
mapping, fragment, *args, **kw)))
File
"c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\cont
rollers.py", line 314, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File
"c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\erro
rhandling.py", line 71, in try_call
return func(self, *args, **kw)
File
"c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\tool
box\catwalk\browse.py", line 24, in index
total,rows =
self.rows_for_model(object_name,start,page_size,filters)
File
"c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\tool
box\catwalk\browse.py", line 115, in rows_for_model
total = query.count()
File
"c:\python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobje
ct\sresults.py", line 188, in count
count = self.accumulate('COUNT(*)')
File
"c:\python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobje
ct\sresults.py", line 171, in accumulate
conn = self._getConnection()
File
"c:\python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobje
ct\sresults.py", line 38, in _getConnection
return self.ops.get('connection') or self.sourceClass._connection
File
"c:\python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobje
ct\dbconnection.py", line 881, in __get__
return self.getConnection()
File
"c:\python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobje
ct\dbconnection.py", line 893, in getConnection
raise AttributeError(
AttributeError: No connection has been defined for this thread or
process
Request Headers:
COOKIE: tg-visit=28a0c3d3b8caa54d4db95cae37f7cd36972f4c66
Content-Length:
ACCEPT-CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.7
USER-AGENT: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.0.3) Gecko/
20060426 Firefox/1.5.0.3
CONNECTION: keep-alive
HOST: localhost:8081
ACCEPT:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/pl
ain;q=0.8,image/png,*/*;q=0.5
Remote-Addr: 127.0.0.1
ACCEPT-LANGUAGE: en-us,en;q=0.5
Content-Type:
Remote-Host: 127.0.0.1
ACCEPT-ENCODING: gzip,deflate
KEEP-ALIVE: 300
127.0.0.1 - - "GET /catwalk/browse/?object_name=CitectServer HTTP/1.1"
500 3356
"" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3)
Gecko/20060426 F
irefox/1.5.0.3"
If I copy and paste my objects into Model.py I get my desired results,
but we all know what kind of drudgery copy and paste can get us into.
Anyone have any ideas?
-chris
"c:\python24\lib\site-packages\TurboGears- 0.9a6-py2.4.egg\turbogears\data
base.py", line 221, in run_with_transaction
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File
"c:\python24\lib\site-packages\TurboGears- 0.9a6-py2.4.egg\turbogears\cont
rollers.py", line 290, in <lambda>
mapping, fragment, *args, **kw)))
File
"c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\cont
rollers.py ", line 314, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File
"c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\erro
rhandling.py", line 71, in try_call
return func(self, *args, **kw)
File
"c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\tool
box\catwalk\browse.py", line 24, in index
total,rows =
self.rows_for_model (object_name,start,page_size,filters)
File
"c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\tool
box\catwalk\browse.py", line 115, in rows_for_model
total = query.count()
File
"c:\python24\lib\site-packages\sqlobject-0.7.1dev_r1588-py2.4.egg\sqlobje
ct\sresults.py", line 188, in count
count = self.accumulate('COUNT(*)')
File
"c:\python24\lib\site-packages\sqlobject- 0.7.1dev_r1588-py2.4.egg\sqlobje
import ft8.turboLink.help.HelpDatabaseModel as HelpDatabaseModel
classes=[]
for value in dir(HelpDatabaseModel):
#print value
try:
#print "HelpDatabaseModel.%s"%value
if issubclass(eval("HelpDatabaseModel.%s"%value), SQLObject):
if value!='SQLObject':
classes.append(value)
except:
pass
del(HelpDatabaseModel)
from ft8.turboLink.help.HelpDatabaseModel import *
for c in classes:
exec("%s._connection = __connection__"%c)
A true hack, complete with the usual execs and evals. However,
I can update my helpdatabasemodel file to my hearts content and never
have to touch model.py.
Also, I can USE helpdatabasemodel in other code without it croaking.
Win Win? Eh?
What does everyone think?
-percious
if issubclass( getattr( HelpDatabaseModel, value ), SQLObject ):
... and ...
for c in classes:
gatattr( HelpDatabaseModel, c ). _connection = __connection__
Sean
I took what you wrote, and came up with this:
import ft8.turboLink.help.HelpDatabaseModel as HelpDatabaseModel
classes=[]
for value in dir(HelpDatabaseModel):
try:
c = getattr( HelpDatabaseModel, value)
if issubclass( c, SQLObject ):
if value!='SQLObject':
classes.append(c)
except:
pass
del(HelpDatabaseModel)
from ft8.turboLink.help.HelpDatabaseModel import *
for c in classes:
c._connection = __connection__
ah. no more evals. Thanks for the help! Much less Hacky now.
-percious