[Zope] Authentication Error on python script db submit

Wayne Connolly Wayne Connolly <wayne@c-media.com.au>
Tue, 17 Jun 2003 23:14:35 +1000


This is a multi-part message in MIME format.

--Boundary_(ID_IQ8tzt7il8t/pjp1pmwdJg)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 7BIT

Hi,

I am trying to connect to a db and UPDATE or INSERT, if the update fails, some data.

The script saves without a error but once the script it run the Zope Authentication window pops up. After 3 login attempts, i know the password :-P, it produces the stupid error "Error Type: Unauthorized
Error Value: You are not allowed to access connect in this context
"
The Proxy roles are set to authenticated on the script(i have tried manager and owner and all 3 at same time).

The script is below.
--------------------------------------------------------------------------
 #!/usr/bin/python 
  
 # import MySQL module 
 import MySQLdb 
  
 # connect 
  db = MySQLdb.connect(host="localhost", user="myUserName", passwd="myPassWord", db="names") 
  
 # create a cursor 
  cursor = db.cursor() 
  
 # execute SQL statement 
 cursor.execute("""INSERT INTO charts (firstname, lastname)""") 
--------------------------------------------------------------------------

Any idea's...

Wayne

--Boundary_(ID_IQ8tzt7il8t/pjp1pmwdJg)
Content-type: text/html; charset=iso-8859-1
Content-transfer-encoding: 7BIT

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I am trying to connect to a db and UPDATE or 
INSERT, if the update fails, some data.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>The script saves without a error but once the 
script it run the Zope Authentication window pops up. After 3 login attempts, i 
know the password :-P,&nbsp;it&nbsp;produces the stupid error "<STRONG><FONT 
face="Times New Roman" size=3>Error Type: Unauthorized<BR>Error Value: You are 
not allowed to access connect in this context</FONT></STRONG><BR>"</FONT></DIV>
<DIV><FONT face=Arial size=2>The Proxy roles are set to authenticated on the 
script(i have tried manager and owner and all 3 at same time).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>The script is below.</FONT></DIV>
<DIV><FONT face=Arial 
size=2>--------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;#!/usr/bin/python <BR>&nbsp; <BR>&nbsp;# 
import MySQL module <BR>&nbsp;import MySQLdb <BR>&nbsp; <BR>&nbsp;# connect 
<BR>&nbsp; db = MySQLdb.connect(host="localhost", user="myUserName", 
passwd="myPassWord", db="names") <BR>&nbsp; <BR>&nbsp;# create a cursor 
<BR>&nbsp; cursor = db.cursor() <BR>&nbsp; <BR>&nbsp;# execute SQL 
statement&nbsp;<BR>&nbsp;cursor.execute("""INSERT INTO charts (firstname, 
lastname)""") 
<DIV><FONT face=Arial 
size=2>--------------------------------------------------------------------------</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>Any idea's...</DIV>
<DIV>&nbsp;</DIV>
<DIV>Wayne</DIV></FONT></DIV></BODY></HTML>

--Boundary_(ID_IQ8tzt7il8t/pjp1pmwdJg)--