[Zope-DB] Python script in Zope
Fejes Róbert
pouch@freemail.hu
Tue, 3 Dec 2002 23:00:21 +0100
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