[Zope] Upgrade 2.6 to 2.7 broke PythonScript access to ZSQL results

Brad Clements bkc at murkworks.com
Mon Jun 7 12:13:48 EDT 2004


(also see new information at the bottom)

Hi all,

I've upgraded a Zope instance from 2.6 to 2.7.0 and now Pythonscripts cannot access 
attributes of ZSQL_Method results.

Even when logged in with the manager role, I get an unauthorized exception.  This 
doesn't seem to be a binding/context security issue.

I'm using gvibDA 0-9-7 on Python 2.3.3 RedHat Linux 8

As Manager, for example, I can test this ZSQL_Method:

--- SQL_Get_User --
select userid as username,userpassword,userrole,orgid,peopleid
from People where userid = <dtml-sqlvar username type=string>
--

I can use the test tab and lookup userid 'brad' and I get the results I expect.

The SQL_Get_User ZSQL_Method is in the same folder as my acl_users folder.
Also in this folder is the PythonScript GetOrgId.

---
r = context.SQL_Get_User(username=username)
if not r:
    return ''
return r[0].orgid
--

(I get the same error if I use container instead of context in this script)

When I test GetOrgId  as a manger (or anyone else for that matter) I get a traceback 
that says I am not allowed to access 'orgid' in this context.

That makes me think that the object being return from the DA doesn't have the correct 
security attributes.

I don't recall reading about any changes in DA or DB.py regarding this.  Any ideas?

I did recompile all python scripts.

---

Traceback (innermost last):
  Module ZPublisher.Publish, line 100, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 40, in call_object
  Module Shared.DC.Scripts.Bindings, line 306, in __call__
  Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 318, in _exec
  Module None, line 7, in GetOrgId
   - <PythonScript at /Strader/P/GetOrgId>
   - Line 7
Unauthorized: You are not allowed to access 'orgid' in this context

----

Oh wait, if I create a new python script with the same code, it works!

Hmm, how do I upgrade all my pythonscripts. I can't retype them all.

-- 
Brad Clements,                bkc at murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
http://www.wecanstopspam.org/                   AOL-IM: BKClements




More information about the Zope mailing list