- Help inserting into MySQL
I've been trying to make a simple application that posts news onto a news page (ala Slashdot or whatever) and then displays it dynamically. I have gotten the display pages to work fine, but I'm having trouble with the Insert page. When I fill out my form, and insert my data, the data actually gets inserted as intended, but I get a "Zope Unavailable" error with the following traceback: Traceback (innermost last): File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/ZPublisher/Publish.py, line 879, in publish_module File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/ZPublisher/Publish.py, line 595, in publish (Info: /pootybbs/newsadder) File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/OFS/Document.py, line 181, in __call__ (Object: newsadder) File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/OFS/Document.py, line 177, in __call__ (Object: newsadder) File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/DocumentTemplate/DT_String.py, line 514, in __call__ (Object: newsadder) File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/DocumentTemplate/DT_Util.py, line 268, in eval (Object: insertnews(sub=submitter, cat=category, tit=titl, bod=body)) File <string>, line 0, in ? File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/Shared/DC/ZRDB/DA.py, line 402, in __call__ (Object: Item) File /projects/build/ZMySQLDA-1.1.0-nonbin/lib/python/Products/ZMySQLDA/db.py, line 178, in query NameError: (see above) How I'm doing the insert: I have a form with four fields (submitter, category, title, body). When you submit, it does "<!--#call "insertnews(sub=submitter, cat=category, tit=titl, bod=body)"--> <!--#var news-->" The "news" object is the same page that displays the news. "insertnews" is a Z SQL method that accepts four arguments (shown above). It also inserts the current timestamp (using PrincipiaTime). So, what silly (and wrong) thing could I have done to cause this error? Thanks for any help. So far, this list has been exceptionally friendly and helpful. Thanks, Chad Fowler (cfowler@fedex.com)
At 07:09 AM 12/27/98 -0000, Chad Fowler wrote:
When I fill out my form, and insert my data, the data actually gets inserted as intended, but I get a "Zope Unavailable" error with the following traceback:
Traceback (innermost last): File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/ZPublisher /Publish.py, line 879, in publish_module File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/ZPublisher /Publish.py, line 595, in publish (Info: /pootybbs/newsadder) File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/OFS/Docume nt.py, line 181, in __call__ (Object: newsadder) File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/OFS/Docume nt.py, line 177, in __call__ (Object: newsadder) File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/DocumentTe mplate/DT_String.py, line 514, in __call__ (Object: newsadder) File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/DocumentTe mplate/DT_Util.py, line 268, in eval (Object: insertnews(sub=submitter, cat=category, tit=titl, bod=body)) File <string>, line 0, in ? File /home/brian/temp/build/tmp_build/Zope-1.9.0-linux2-x86/lib/python/Shared/DC/ ZRDB/DA.py, line 402, in __call__ (Object: Item) File /projects/build/ZMySQLDA-1.1.0-nonbin/lib/python/Products/ZMySQLDA/db.py, line 178, in query NameError: (see above) .. So, what silly (and wrong) thing could I have done to cause this error?
It's hard to say what's wrong from this traceback. Further up in the source of the error page you should have a comment which tells what the NameError is. If the NameError is something like one of your input variables in your SQL Method than it is likely that you are calling it incorrectly from DTML. If the NameError is breaking on some obscure name which only occurs in the Zope code than it is likely a Zope bug. If it looks like a Zope bug, please submit it on the Zope site at: http://www.zope.org/Collector Hope this helps. -Amos
participants (2)
-
Amos Latteier -
Chad Fowler