Getting the following error after visiting my site, issuing a query on
the picture database, closing window, then re-visiting site.
Traceback (most recent call last):
File
"/usr/lib/python2.4/site-packages/CherryPy-2.1.0-py2.4.egg/cherrypy/_cphttptools.py",
line 271, in run
main()
File
"/usr/lib/python2.4/site-packages/CherryPy-2.1.0-py2.4.egg/cherrypy/_cphttptools.py",
line 502, in main
body = page_handler(*args, **cherrypy.request.paramMap)
File "/home/mikez0r/TG0.9/trunk/turbogears/controllers.py", line 240,
in newfunc
html, fragment, *args, **kw)
File "/home/mikez0r/TG0.9/trunk/turbogears/database.py", line 189, in
run_with_transaction
retval = func(*args, **kw)
File "/home/mikez0r/TG0.9/trunk/turbogears/controllers.py", line 262,
in _execute_func
return _process_output(tg_format, output, html, fragment)
File "/home/mikez0r/TG0.9/trunk/turbogears/controllers.py", line 62,
in _process_output
output = view.render(output, tg_format,
template=template,fragment=fragment)
File "/home/mikez0r/TG0.9/trunk/turbogears/view.py", line 57, in
render
return engine.render(info, format, fragment, template)
File
"/usr/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py",
line 136, in render
return t.serialize(encoding=self.defaultencoding, output=format,
fragment=fragment)
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py",
line 232, in serialize
return serializer.serialize(self, encoding, fragment)
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/serialization.py",
line 51, in serialize
text = list(self.generate(stream, encoding, fragment))
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/serialization.py",
line 316, in generate
stream = iter(stream)
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py",
line 257, in __iter__
return iter(self.transform())
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py",
line 312, in transform
stream = self.pull()
File
"/usr/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py",
line 271, in pull
self.initialize()
File
"/var/www/localhost/htdocs/gallerytest/gallerytest/templates/howdy.py",
line 19, in initialize
File
"/var/www/localhost/htdocs/gallerytest/gallerytest/templates/master.py",
line 19, in initialize
TypeError: 'NoneType' object is not callable
Currently, the only fix I've found is to re-start the project.
I'm guessing that I'm missing something to close the database
connection, and it's mucking things up. Any suggestions?
applicable sections from controllers:
class Root(controllers.Root):
@turbogears.expose(html="gallerytest.templates.howdy")
def index(self):
weee='weeeee'
return dict(weee=weee)
# Start pic display section
@turbogears.expose(html="gallerytest.templates.pics")
def pics(self,search_terms='',ppp=9,pagenum=0,loc_sub='',set_id=0):
if search_terms!='':
search_term_list = search_terms.replace(',','')
search_term_list = search_term_list.lower()
search_term_list = search_term_list.split()
union_set=[]
setlist=[]
for term in search_term_list:
idlist=[]
imgsearch=set(list(Searchtable.select(
OR(Searchtable.q.galleryterms.contains(term),
Searchtable.q.imageterms.contains(term)))))
for result in imgsearch:
idlist=idlist+[result.alt_ID]
setlist=setlist+[set(idlist)]
union_set=setlist[0]
for s in setlist:
union_set=union_set & s
idlist=str(union_set)[4:-1]
elif loc_sub!='':
idlist=[]
imgsearch=list(Photoinfo.select(Photoinfo.q.loc_sub==loc_sub))
for result in imgsearch:
idlist+=[result.alt_ID]
pagenum=int(pagenum)
start=pagenum*ppp
end=start+ppp
idlist=str(idlist)
idlist=idlist.strip('[]')
idlist=idlist.replace(',','')
newlist=idlist.split()
idlist=[]
for id in newlist:
idlist=idlist+[int(id)]
imgquery=[]
for id in idlist:
set_id=int(set_id)
set_id=set_id+1
set_id=str(set_id)
imgquery = imgquery + [{
'date':s.date,
'camera':s.camera,
'loc_sub':s.loc_sub,
'disk_loc':s.disk_loc,
'name':s.name,
'focallength':s.focallength,
'alt_ID':s.alt_ID,
'set_id':set_id
}
for s in Photoinfo.select(Photoinfo.q.alt_ID==id)
]
imgcount=len(imgquery)
if imgcount<start:
start=imgcount-8
end=imgcount
elif imgcount<end:
end=imgcount
return
dict(imgquery=imgquery,imgcount=imgcount,start=start,end=end,pagenum=pagenum,search_terms=search_terms,ppp=ppp,loc_sub=loc_sub)
:(
There are more people who experience the same problem, check the
thread "kid templates are a pain to debug".
> Currently, the only fix I've found is to re-start the project.
same here
> I'm guessing that I'm missing something to close the database
> connection, and it's mucking things up. Any suggestions?
I think it's SQLObject related, but i can't find any solution either.
--
Ksenia