[Zope-DB] Python script in Zope

working4aliving working4aliving@hotmail.com
Thu, 5 Dec 2002 14:05:31 -0500


If you did want to use this script in zope, than it must be in the form of
an external method.

----- Original Message -----
From: "Fejes Róbert" <pouch@freemail.hu>
To: <zope-db@zope.org>
Sent: Tuesday, December 03, 2002 5:00 PM
Subject: [Zope-DB] Python script in Zope


Hi!

I've got the following Python script:
# Example code:

import MySQLdb
db = MySQLdb.connect(host="localhost", user="root", passwd="secret",
db="test")
cursor = db.cursor()
cursor.execute("SELECT * FROM books")
result = cursor.fetchall()
for record in result:
print record[0], "-->", record[1]

This works well on the Python interpreter console. How can I use it in Zope?
I
clicked on Select type to add ..., chose Script(Python), copied the code
mentioned before, but it did not work:( When testing it says:
Error Type: Unauthorized
Error Value: You are not allowed to access connect in this context

What to modify, then?

Bye: FeRó
//SuSE 8.0, Zope 2.5, Python 2.2, MySQL 3.23.48



_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://lists.zope.org/mailman/listinfo/zope-db