[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Anyone correct me if I'm wrong, but I think you could also run easy-install . in any directory you want to compile from the source that's there. (plugins/kid, etc.) Elvelind, thanks for all the great tips and tricks lately on using TG more effectively. -Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups TurboGears group. To post to this group, send email to turbogears@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~--~~~~--~~--~--~---
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Kevin, I think there may be a problem with upgrading from 0.8 - things are working fine for me now that I removed everything and started over only installing SVN. That might help explain the odd line numbers. Perhaps it was using the ealier version of either TurboGears or TurboKid. Still, it seems like the debug output indicated that it was going to the correct version... Dreamhost's fastcgi support leaves much to be desired - my site is down until it randomly decides to work again (generally a day or two), but I'll let you all know if I still encounter the nonetype error once it comes up again. -Mike
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Drew, after this error comes up for you, does the rest of your site remain functional, or do you have to restart TG? Sometimes for me some of the pages will continue to work, while others stay broken after that comes up, and other times it just breaks everything kid-related.
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Also check your site-packages directory. I've noticed old versions of many packages sometimes don't get deleted automatically. I'm not sure if they interfere, but after an update I always go in there and clear out the cruft just to eliminate the possibility.
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
You can also run tg-admin info to show which versions Turbogears uses of everything. On 2/9/06, isaac [EMAIL PROTECTED] wrote: Also check your site-packages directory. I've noticed old versions of many packages sometimes don't get deleted automatically. I'm not sure if they interfere, but after an update I always go in there and clear out the cruft just to eliminate the possibility. -- cheers elvelind grandin
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
The rest of the site works ok. The error starts up after I come back to the problem page from another. ... I've just now done a 'python -c import setuptools; execfile('setup.py') develop ' in the svn versions plugins/kid dircectory and it looks to have fixed the problem. Up until now I hadn't realized that a python setup.py develop in the svn root wasn't sufficient to get all the latest turbogears plugins installed. I had done this for a whole bunch of the thirdparty packages like cherrypy, kid and sqlobject. Fingers crossed. -Drew
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Hi Mike, Sorry to leave you hanging there... I've never encountered the problem you're reporting. One thing I can say, though: the line numbers in your traceback don't correspond to the kidsupport.py file that's in svn right now. I'd install TurboKid from plugins/kid, if I were you. Kevin On 2/7/06, Mike Sarahan [EMAIL PROTECTED] wrote: Kevin (or anyone else), Any idea on a fix? How do I go about turning on kid's import hook? I tried running kidc on each of the kid files in that folder, and it generated the pyc files, but it still dies with the same error. -Mike -- Kevin Dangoor Author of the Zesty News RSS newsreader email: [EMAIL PROTECTED] company: http://www.BlazingThings.com blog: http://www.BlueSkyOnMars.com
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Kevin, Here's a traceback after I ran both easy_install . and python setup.py develop/install in plugins/kid and in thirdparty/kid: Traceback (most recent call last): File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/CherryPy-2.2.0beta-py2.4.egg/cherrypy/_cphttptools.py, line 99, in _run self.main() File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/CherryPy-2.2.0beta-py2.4.egg/cherrypy/_cphttptools.py, line 247, in main body = page_handler(*virtual_path, **self.params) File string, line 3, in index File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboGears-0.9a0dev_r694-py2.4.egg/turbogears/controllers.py, line 188, in expose func, tg_format, html, fragment, *args, **kw) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboGears-0.9a0dev_r694-py2.4.egg/turbogears/database.py, line 193, in run_with_transaction retval = func(*args, **kw) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboGears-0.9a0dev_r694-py2.4.egg/turbogears/controllers.py, line 205, in _execute_func return _process_output(tg_format, output, html, fragment) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboGears-0.9a0dev_r694-py2.4.egg/turbogears/controllers.py, line 68, in _process_output fragment=fragment) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboGears-0.9a0dev_r694-py2.4.egg/turbogears/view.py, line 60, in render return engine.render(info, format, fragment, template) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py, line 88, in render tclass = self.load_template(template) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py, line 42, in load_template self.load_template(self.stname, True) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py, line 56, in load_template mod = kid.load_template(classname) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/kid-0.9a0-py2.4.egg/kid/__init__.py, line 112, in load_template raise Exception, Template not found: %s (in %s) % ( Exception: Template not found: turbogears.fastdata.templates.sitetemplate (in /home/.castor/mikez0r/elementarycatastrophe.com, /) Same TurboKid line numbers... I'll try a re-install later today. Is the best path still to install 0.8, and then upgrade? That's what I've been doing, but if it might introduce problems, I'll just go through the dep's and get to SVN directly. -Mike
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
For what it's worth I'm seeing this error at the moment with the latest svn versions. I can trigger it reliably by selecting some links in a particular order. Here is the error ... 500 Internal error The server encountered an unexpected condition which prevented it from fulfilling the request. Page handler: bound method Root.index of vrq.controllers.Root object at 0xb796eb8c Traceback (most recent call last): File /store/projects/z03/drw900/src/turbogears_SVN/thirdparty/cherrypy/cherrypy/_cphttptools.py, line 99, in _run self.main() File /store/projects/z03/drw900/src/turbogears_SVN/thirdparty/cherrypy/cherrypy/_cphttptools.py, line 247, in main body = page_handler(*virtual_path, **self.params) File string, line 3, in index File /store/projects/z03/drw900/src/turbogears_SVN/turbogears/controllers.py, line 189, in expose func, tg_format, html, fragment, *args, **kw) File /store/projects/z03/drw900/src/turbogears_SVN/turbogears/database.py, line 193, in run_with_transaction retval = func(*args, **kw) File /store/projects/z03/drw900/src/turbogears_SVN/turbogears/controllers.py, line 206, in _execute_func return _process_output(tg_format, output, html, fragment) File /store/projects/z03/drw900/src/turbogears_SVN/turbogears/controllers.py, line 69, in _process_output fragment=fragment) File /store/projects/z03/drw900/src/turbogears_SVN/turbogears/view.py, line 60, in render return engine.render(info, format, fragment, template) File /home/900/drw900/python24/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 /store/projects/z03/drw900/src/turbogears_SVN/thirdparty/kid/kid/__init__.py, line 236, in serialize return serializer.serialize(self, encoding, fragment) File /store/projects/z03/drw900/src/turbogears_SVN/thirdparty/kid/kid/serialization.py, line 51, in serialize text = list(self.generate(stream, encoding, fragment)) File /store/projects/z03/drw900/src/turbogears_SVN/thirdparty/kid/kid/serialization.py, line 324, in generate stream = iter(stream) File /store/projects/z03/drw900/src/turbogears_SVN/thirdparty/kid/kid/__init__.py, line 261, in __iter__ return iter(self.transform()) File /store/projects/z03/drw900/src/turbogears_SVN/thirdparty/kid/kid/__init__.py, line 316, in transform stream = self.pull() File /store/projects/z03/drw900/src/turbogears_SVN/thirdparty/kid/kid/__init__.py, line 275, in pull self.initialize() File /store/projects/z03/drw900/vrq/vrq/templates/renders.py, line 20, in initialize File /store/projects/z03/drw900/vrq/vrq/templates/master.py, line 20, in initialize TypeError: 'NoneType' object is not callable -Drew
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Lee, You're amazingly good at blind guesses. That bin/python/bin dir is a shortcut dir linked to the python binary. I have to set it up this way because it's running on dreamhost - not on one of my boxes. I have an installation of python that's hopefully being used over their install (2.3). I think that's working ok, because running python gives me my version 2.4.2, and the interpreter line of the script I run TG from is pointed to the proper python binary (~/bin/python/bin/python). I moved $HOME/lib/lib/python2.4/... to the beginning, but still no luck. Just to check, I made sure that the turbogears/fastdata...sitetemplate exists in the egg folder, and it does, so I don't know where it's getting caught up. I was poking around with google, and thought it might help to set a PYTHONPATH variable. I set that to: export PYTHONPATH=$HOME/lib/lib/python2.4/:$PATH Still won't import the sitetemplate, but check out what I get when I run import sys print sys.path ['', '/home/mikez0r/lib/lib/python2.4', '/home/mikez0r/lib/lib/python2.4/site-packages/TurboGears0.9a0dev_r646-py2.4.egg', '/home/mikez0r/bin/python/bin', '/home/mikez0r/lib/bin', '/usr/local/bin', '/usr/bin', '/bin', '/usr/bin/X11', '/usr/games', '/home/mikez0r/lib/lib/python24.zip', '/home/mikez0r/lib/lib/python2.4/plat-linux2', '/home/mikez0r/lib/lib/python2.4/lib-tk', '/home/mikez0r/lib/lib/python2.4/lib-dynload', '/home/mikez0r/lib/lib/python2.4/site-packages', '/home/mikez0r/lib/lib/python2.4/site-packages/PIL', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/TestGears-0.2-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/FormEncode-0.4-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/cElementTree-1.0.5_20051216-py2.4-linux-i686.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/elementtree-1.2.6-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/json_py-3.4-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1457-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/nose-0.8.6-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/PyProtocols-1.0a0-py2.4-linux-i686.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/RuleDispatch-0.5a0-py2.4-linux-i686.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/PasteScript-0.4.2-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/simplejson-1.1-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/CherryPy-2.2.0beta-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/Cheetah-1.0-py2.4-linux-i686.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/PasteDeploy-0.4-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/Paste-0.4.1-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/kid-0.9a0-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg', '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboGears-0.9a0dev_r646-py2.4.egg'] Sure looks like it is looking in the proper dir. Why on earth can't it find that sitetemplate?
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Mike, Can you import other stuff from turbogears in the python shell? e.g. import turbogears.widgets or from turbogears import controllers? If so, can you paste the output of ls in the turbogears/fastdata/templates directory? If not then something is seriously amiss and I would try starting from scratch with respect to your python and turbogears installs if that's possible. Lee
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
importing other turbogears stuff worked just fine, still nothing on the sitetemplate. Here's the ls in $HOME/lib/lib/python2.4/site-packages/TurboGears.../turbogears/fastdata/templates total 28 -rw-rw-r-- 1 mikez0r pg4915910 2006-02-06 18:33 __init__.py -rw-rw-r-- 1 mikez0r pg491591 210 2006-02-06 18:33 __init__.pyc -rw-rw-r-- 1 mikez0r pg491591 1171 2006-02-06 18:33 datagrid.kid -rw-rw-r-- 1 mikez0r pg491591 435 2006-02-06 18:33 form.kid -rw-rw-r-- 1 mikez0r pg491591 599 2006-02-06 18:33 item.kid -rw-rw-r-- 1 mikez0r pg491591 432 2006-02-06 18:33 list.kid -rw-rw-r-- 1 mikez0r pg491591 774 2006-02-06 18:33 master.kid -rw-rw-r-- 1 mikez0r pg491591 732 2006-02-06 18:33 sitetemplate.kid
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
On 2/7/06, Mike Sarahan [EMAIL PROTECTED] wrote: importing other turbogears stuff worked just fine, still nothing on the sitetemplate. Here's the ls in $HOME/lib/lib/python2.4/site-packages/TurboGears.../turbogears/fastdata/templates total 28 -rw-rw-r-- 1 mikez0r pg4915910 2006-02-06 18:33 __init__.py -rw-rw-r-- 1 mikez0r pg491591 210 2006-02-06 18:33 __init__.pyc -rw-rw-r-- 1 mikez0r pg491591 1171 2006-02-06 18:33 datagrid.kid -rw-rw-r-- 1 mikez0r pg491591 435 2006-02-06 18:33 form.kid -rw-rw-r-- 1 mikez0r pg491591 599 2006-02-06 18:33 item.kid -rw-rw-r-- 1 mikez0r pg491591 432 2006-02-06 18:33 list.kid -rw-rw-r-- 1 mikez0r pg491591 774 2006-02-06 18:33 master.kid -rw-rw-r-- 1 mikez0r pg491591 732 2006-02-06 18:33 sitetemplate.kid Odd... that is as it should be. Ok, before I go completely crazy and suggest a complete removal and reinstall of turbogears, does import turbogears.fastdata.templates.datagrid work?
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Kevin, here's the output: import pkg_resources pkg_resources.resource_filename(turbogears.fastdata.templates,sitetemplate.kid) '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboGears-0.9a0dev_r646-py2.4.egg/turbogears/fastdata/templates/sitetemplate.kid' I know you're busy - thanks for taking some time for this. -Mike
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
As for TG appearing twice, it's because it comes up once when I have it manually set in the PATH variable, and again when I set the PYTHONPATH. I'll fix that.
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
On 2/7/06, Mike Sarahan [EMAIL PROTECTED] wrote: here's the output: import pkg_resources pkg_resources.resource_filename(turbogears.fastdata.templates,sitetemplate.kid) '/home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboGears-0.9a0dev_r646-py2.4.egg/turbogears/fastdata/templates/sitetemplate.kid' I believe this is exactly the code used by kidsupport to find the template. That would seem to imply that something is different between running in the shell and when you're running in TurboGears. I just noticed something fishy... from your original recent message: ine 108, in load_template raise Exception, Template not found: %s (in %s) % ( Exception: Template not found: turbogears.fastdata.templates.sitetemplate (in /home/.castor/mikez0r/elementarycatastrophe.com, /) The name turbogears.fastdata.templates.sitetemplate clearly isn't going to work as a filename in the system. It would seem that this filename wasn't getting resolved as a name along the pythonpath. Kevin
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Kevin (or anyone else), Any idea on a fix? How do I go about turning on kid's import hook? I tried running kidc on each of the kid files in that folder, and it generated the pyc files, but it still dies with the same error. -Mike
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Are you certain you've installed the latest version of turbokid? Switch to plugins\kid and run easy_install . Remeber to use your easy_install arguments (--script-dir, sudo, etc) as you did with python setup.py develop in the root TG dir. Lee
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Good idea, Lee, but unfortunately, it didn't work. Same sitetemplate error showing up.
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
On 2/6/06, Mike Sarahan [EMAIL PROTECTED] wrote: Good idea, Lee, but unfortunately, it didn't work. Same sitetemplate error showing up. Actually, looking closer at your traceback this looks more like some kind of path error. If you open up a python shell at any arbitary path you should always be able to do: import turbogears.fastdata.templates.sitetemplate If this fails then you will need to check your installation is correct, i.e. your easy-install.pth file is correct and your system's $PATH variable is grabbing your SVN version over any other version you have installed. Lee
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
This error is still a showstopper for my site, even with SVN 646. David, if you'd like, I will give you the login for my dreamhost site, if it will help you track down the bug. Mike
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Also, running a python setup.py develop in plugins/kid brings up the sitetemplate not found error: Traceback (most recent call last): File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/CherryPy-2.2.0beta-py2.4.egg/cherrypy/_cphttptools.py, line 99, in _run self.main() File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/CherryPy-2.2.0beta-py2.4.egg/cherrypy/_cphttptools.py, line 247, in main body = page_handler(*virtual_path, **self.params) File string, line 3, in index File /home/.castor/mikez0r/download/trunk/turbogears/controllers.py, line 218, in expose func, tg_format, html, fragment, *args, **kw) File /home/.castor/mikez0r/download/trunk/turbogears/database.py, line 193, in run_with_transaction retval = func(*args, **kw) File /home/.castor/mikez0r/download/trunk/turbogears/controllers.py, line 253, in _execute_func return _process_output(tg_format, output, html, fragment) File /home/.castor/mikez0r/download/trunk/turbogears/controllers.py, line 66, in _process_output fragment=fragment) File /home/.castor/mikez0r/download/trunk/turbogears/view.py, line 60, in render return engine.render(info, format, fragment, template) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py, line 88, in render tclass = self.load_template(template) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py, line 42, in load_template self.load_template(self.stname, True) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/TurboKid-0.9.0-py2.4.egg/turbokid/kidsupport.py, line 56, in load_template mod = kid.load_template(classname) File /home/.castor/mikez0r/lib/lib/python2.4/site-packages/kid-0.8-py2.4.egg/kid/__init__.py, line 108, in load_template raise Exception, Template not found: %s (in %s) % ( Exception: Template not found: turbogears.fastdata.templates.sitetemplate (in /home/.castor/mikez0r/elementarycatastrophe.com, /) I noticed that the kid version there is 0.8, so I ran python setup.py develop in thirdparty/kid That gives the same error, with the kid version changing to 0.9.
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
This is really getting to be a bane for me. After a while I'll get the following traceback: Page handler: bound method Root.search of archive.controllers.Root object at 0x00FAE2F0 Traceback (most recent call last): File c:\python24\lib\site-packages\cherrypy-2.2.0beta-py2.4.egg\cherrypy\_cphttptools.py, line 98, in _run self.main() File c:\python24\lib\site-packages\cherrypy-2.2.0beta-py2.4.egg\cherrypy\_cphttptools.py, line 246, in main body = page_handler(*virtual_path, **self.params) File c:\svn\turbogears\turbogears\controllers.py, line 240, in newfunc html, fragment, *args, **kw) File c:\svn\turbogears\turbogears\database.py, line 189, in run_with_transaction retval = func(*args, **kw) File c:\svn\turbogears\turbogears\controllers.py, line 262, in _execute_func return _process_output(tg_format, output, html, fragment) File c:\svn\turbogears\turbogears\controllers.py, line 62, in _process_output output = view.render(output, tg_format, template=template,fragment=fragment) File c:\svn\turbogears\turbogears\view.py, line 57, in render return engine.render(info, format, fragment, template) File c:\python24\lib\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 c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid\__init__.py, line 236, in serialize return serializer.serialize(self, encoding, fragment) File c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid\serialization.py, line 51, in serialize text = list(self.generate(stream, encoding, fragment)) File c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid\serialization.py, line 324, in generate stream = iter(stream) File c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid\__init__.py, line 261, in __iter__ return iter(self.transform()) File c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid\__init__.py, line 316, in transform stream = self.pull() File c:\python24\lib\site-packages\kid-0.9a0-py2.4.egg\kid\__init__.py, line 275, in pull self.initialize() File C:\svn\mailarc\frontend\trunk\archive\templates\search.py, line 20, in initialize File C:\svn\mailarc\frontend\trunk\archive\templates\master.py, line 20, in initialize TypeError: 'NoneType' object is not callable The strange thing is, this happens only on *one* of my templates. The other 2 which are currently accessible work without a problem. I have attached my controller, and the templates of the app in question because I've been trying to track this issue down for a few days. If anyone needs further info, please just ask. I will continue to hunt, but I am having to put it on the backburner to get the rest of the app finished in time. Thanks in advance, Lee import turbogears from turbogears import controllers, widgets, validators from model import Message, Recipient, Person, Attachment, Body, Unknown from datetime import datetime from sqlobject import NOT, AND, OR, SQLObjectNotFound import cherrypy from turbogears import jsonify import myforms def size_suffix(value): suffix = [B, KB, MB, GB] i = 0 while value 1024: value = value/1024 i += 1 return suffix[i] class AttachmentController(controllers.Controller): @turbogears.expose() def default(self, *vpath, **params): if not vpath: return self.index(**params) # Make a copy of vpath in a list vpath = list(vpath) atom = vpath.pop(0) # See if the first virtual path member is a container action method = getattr(self, atom, None) if method and getattr(method, exposed): return method(*vpath, **params) # Not a container action; the URI atom must be an existing ID # Coerce the ID to the correct db type try: id = int(atom) att = Attachment.get(id) except SQLObjectNotFound, ValueError: raise cherrypy.NotFound # There may be further virtual path components. # Try to map them to methods in this class. if vpath: method = getattr(self, vpath[0], None) if method and getattr(method, exposed): return method(message=message, id=id, *vpath[1:], **params) else: raise cherrypy.NotFound # No further known vpath components. Call a default handler. return self.download(att=att, id=id, *vpath, **params) @turbogears.expose() def download(self, att=None, id=None, *args, **kw): Downloads the attachment for the given NewsPost id from StringIO import StringIO #This is for streaming from the DB import urllib referer = cherrypy.request.headerMap.get('Referer', '/') if att or id: if not att: try: att = Attachment.get(id)
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Lee McFadden [EMAIL PROTECTED] writes: TypeError: 'NoneType' object is not callable Dunno if the tracebak is the same, but after I switched a project from prod.cfg/dev.cfg to procfg.py/devcfg.py + config.py I started getting those as well. I haven't, yet, tried restoring the old config files. I also started having problems with Identity (it requires me to fill my username and password for each and every page I access, no matter if it is just a link on the same page I acessed right now!) -- Jorge Godoy [EMAIL PROTECTED]
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Jorge Godoy [EMAIL PROTECTED] writes: Lee McFadden [EMAIL PROTECTED] writes: TypeError: 'NoneType' object is not callable Dunno if the tracebak is the same, but after I switched a project from prod.cfg/dev.cfg to procfg.py/devcfg.py + config.py I started getting those as well. I haven't, yet, tried restoring the old config files. I also started having problems with Identity (it requires me to fill my username and password for each and every page I access, no matter if it is just a link on the same page I acessed right now!) Just as a feedback: definitely the change has broken something here. I've restored my old configuration and the problems I related were solved. What I did was (from the top of my head, I haven't written down what I did and haven't repeated it here): - create a new empty project - copy its devcfg.py/procfg.py/config.py and change all references to the dummy project name to my real project name - modify procfg.py / decvfg.py so that my database URIs were correct - modify config.py adding the Visit (I still get errors if it is disabled...) and Identity configurations I need - copied the dummy project start-project.py script - removed old dev.cfg / prod.cfg / project-start.py files - started the project It worked, but: * I have to fill the password on every new page and also when I come back to an already visited page. * I started getting the NoneType error that didn't exist before I hope this helps digging what is the cause of the problem. Be seeing you, -- Jorge Godoy [EMAIL PROTECTED]
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
On 1/25/06, Jorge Godoy [EMAIL PROTECTED] wrote: Just as a feedback: definitely the change has broken something here. I've restored my old configuration and the problems I related were solved. What I did was (from the top of my head, I haven't written down what I did and haven't repeated it here): - create a new empty project - copy its devcfg.py/procfg.py/config.py and change all references to the dummy project name to my real project name - modify procfg.py / decvfg.py so that my database URIs were correct - modify config.py adding the Visit (I still get errors if it is disabled...) and Identity configurations I need - copied the dummy project start-project.py script - removed old dev.cfg / prod.cfg / project-start.py files - started the project It worked, but: * I have to fill the password on every new page and also when I come back to an already visited page. * I started getting the NoneType error that didn't exist before This is almost exactly what I did to get my project working after the move from the .cfg config files to the .py config files. The only difference is that I have both visit and identity turned off as I have no need of those at the moment. Lee
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Lee McFadden [EMAIL PROTECTED] writes: This is almost exactly what I did to get my project working after the move from the .cfg config files to the .py config files. The only difference is that I have both visit and identity turned off as I have no need of those at the moment. I haven't tried quickstarting a new project and moving my data files to it... I think it might be worth testing that to see if we forgot testing something. -- Jorge Godoy [EMAIL PROTECTED]
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Lee, I saw the same issue. All of my kid templates would work except for one, and the problem template was a very simple one. I found that the only way to solve the problem was to hack TurboKid with the code I posted at the start of this thread. The problem has completely gone away with the hack in place, however, hopefully a real patch will be created to solve the issue. Sean
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
On 1/25/06, Sean De La Torre [EMAIL PROTECTED] wrote: The problem has completely gone away with the hack in place, however, hopefully a real patch will be created to solve the issue. Unless I'm missing something _freshen_template() is no longer used at all in kidsupport.py. I'll look for it more later today when I get back onto this problem. I'm giving my brain a rest from that particular track at the moment. :) Lee
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
I didn't notice that kidsupport.py changed :). Unfortunately, the error looks very similar to the last one. Sean
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
On 1/25/06, Sean De La Torre [EMAIL PROTECTED] wrote: I didn't notice that kidsupport.py changed :).Unfortunately, theerror looks very similar to the last one. Are you using the newest version on TurboKid? Even after the svn update you have to run the setup.py file for it. -- David
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
I wasn't using the newest version, but have since upgraded and the problem is gone. Thanks! Sean
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
I'm still getting horrible issues with the NoneType is not callable error. I'm using kid as my template engine and, admittedly, this is from an older quickstarted project. I'm running on the latest SVN (as of 9am GMT this morning) and there is no longer a kidsupport.py for me to edit. If anyone has any ideas it would be much appreciated. Lee
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Lee. I belive the kidsupport.py now lives in the TurboKid package. On 1/24/06, Lee McFadden [EMAIL PROTECTED] wrote: I'm still getting horrible issues with the NoneType is not callable error. I'm using kid as my template engine and, admittedly, this is from an older quickstarted project. I'm running on the latest SVN (as of 9am GMT this morning) and there is no longer a kidsupport.py for me to edit. If anyone has any ideas it would be much appreciated. Lee -- cheers elvelind grandin
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
This didn't work here. (latest svn 520)...
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
On 1/17/06, nerkles [EMAIL PROTECTED] wrote: This didn't work here. (latest svn 520)...Looks like the None issue has gone away, but another evil issue has taken it's place. Try doing a 'python setup.py develop' on turbokid. The other issue seems to be with FormEncode/widgets/TurboKid. Things are being accessed be the __classinit__, that don't appear to exist. I have not had a ton of time to look into this yet. Here is a link posted in IRC: http://tg.pastebin.com/509759. -- David
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
now the app doesn't work at all. I just get an error... same as the one in the pastebin.
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
I'll check the next time it happens.On 14 Jan, 2006, at 12:47 am, Sean De La Torre wrote:Do you also see the "turbokid.kidsupport DEBUG 'turbogears.fastdata.templates.sitetemplate' needs freshening" message in your logs? -- Jeff Watkinshttp://newburyportion.com/"Daddy, I want a purple iMac. And I want ice cream!"-- Unidentified 7-year-old to his father.
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Nope.On 14 Jan, 2006, at 12:47 am, Sean De La Torre wrote: Do you also see the "turbokid.kidsupport DEBUG 'turbogears.fastdata.templates.sitetemplate' needs freshening" message in your logs? --Jeff Watkinshttp://newburyportion.com/"Computers are like Old Testament gods; lots of rules and no mercy."-- Joseph Campbell
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Removing the entire if and leaving only mod = _recompile_template(...) works great for me. No more nonetype is not callable errors. -- JP
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
Except that I get this error also and I don't use widgets. I'm not saying you haven't tracked down *ONE* cause of it, but it certainly isn't the only cause. On 13 Jan, 2006, at 10:05 pm, Sean De La Torre wrote: I've found what causes the TypeError: 'NoneType' object is not callable error in Kid templates. I've narrowed it down to the _freshen_template method in the TurboKid kidsupport.py file. -- Jeff Watkins http://newburyportion.com/ Advertising directed at children is inherently deceptive and exploits children under eight years of age. -- American Academy of Pediatrics
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
I didn't intend to state that this was the exact solution to all the problems (hence the statement This could be a more general error in the refresh logic or in the way kid reloads templates, but I won't know for certain until I've investigated the issue a little more. ). Besides, the disappearing widget is not the point of my message, it's just a symptom. When running normally, there are two components being rendered. When the error occurs, one goes missing, which probably results in the NoneType error. A quick question since you are seeing this too. When you see the error, take a look at the request immediately before the error happens. Do you also see the turbokid.kidsupport DEBUG 'turbogears.fastdata.templates.sitetemplate' needs freshening message in your logs? Thanks, Sean
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
One more thing that I just tested: I removed the widget from my code, and tested the same scenario with only templates in my project. I then reverted kidsupport.py to its original state, and the error reappears after I see the refresh statement in my logs. Changing kidusupport.py as I stated above fixes the issue, which leads me to believe that the problem does have something to do with the refresh process. I'm running the latest svn version of TG on a WinXP SP2 box. Sean
[TurboGears] Re: Found the source of Kid's TypeError: 'NoneType' object is not callable error
I am 100% positive that it is the module reloading. With my setup I cannot recreate the issue so it is impossible for me to debug. I am working on a patch that really cleans the reloading up. It's pretty late here so I will post it to the list tomorrow after I make sure I am not doing anything really dumb. -- David