[Zope-dev] Trying to understand the nuances of a VerboseSecurity report ..

Jean Jordaan jean@upfrontsystems.co.za
Tue, 04 Mar 2003 11:14:17 +0200


Hi Shane, Toby ..

Set Tardis for
http://mail.zope.org/pipermail/zope-dev/2003-February/018837.html

>> All I can think is that that object 'basic' lacks context for
>> some reason (i.e. lacks an acquisition wrapper?). I can't think
>> why it lacks context .. we use that idiom all over the app, and
>> don't normally get any problems.
> 
> That's all I can think of also.  Try examining basic.aq_chain.

It looks like bad interaction with ZUnit:

(Pdb) license.propertysheets.basic
<ZInstanceSheet instance at 9a6f350>
(Pdb) license.propertysheets.basic.aq_chain
[<ZInstanceSheet instance at 9a6f350>, <License_PropertySheetsClass 
instance at 9a6f128>, <License instance at 9e19038>, <Specialist 
instance at 99ae6d8>, <Specialist instance at 996acd0>, <Folder instance 
at 9cad3b0>, *** AttributeError: testsRun

'testsRun' is an attribute that is set in ZUnit.TestMonitor
I'm poking about in ZUnit now .. benightedly ..

Here is the code context in which the above obtains::

     # Create a new reminder and reference it from the License
     reminder = container.addInstance(no_redir=1)
     import pdb; pdb.set_trace() #DBG We are here. This fails:
     license.propertysheets.basic.manage_changeProperties(
        {reminder_id_property: reminder.id})

That is in a Script (Python). The 'license' instance was
created in the calling Script (Python), and passed in as parameter.
Calling sequence:

   addLicenses (called from a ZUnitExternal test suite) ->
   addLicense (creates license instance) ->
   doRemindersForLicense(license) (creates reminder instance;
      calls license.propertysheets.basic.manage_changeProperties)

Perhaps interestingly, reminder and AUTHENTICATED_USER seem to be
OK, and license and context do not:

(Pdb) reminder.aq_chain
[<Reminder instance at 9c39bb0>, <Specialist instance at 99682a0>, 
<Application instance at 9968a48>, <RequestContainer instance at 8fd9e68>]
(Pdb) license.aq_chain
[<License instance at 9e19038>, <Specialist instance at 99ae6d8>, 
<Specialist instance at 996acd0>, <Folder instance at 9cad3b0>, *** 
AttributeError: testsRun
(Pdb) context.aq_chain
[<Specialist instance at 99682a0>, <Specialist instance at 99ae6d8>, 
<Specialist instance at 996acd0>, <Folder instance at 9cad3b0>, *** 
AttributeError: testsRun
(Pdb) context.REQUEST.AUTHENTICATED_USER.aq_chain
[jean, <LoginManager instance at 996f588>, <Application instance at 
9968a48>, <RequestContainer instance at 8fd9e68>]

-- 
Jean Jordaan
http://www.upfrontsystems.co.za