help with soappy issue

Eric Olson eolson at mcs.anl.gov
Mon Apr 5 20:55:14 CDT 2004


I've narrowed down a soappy issue I'm having to a problem with returning a 
list of actions where any two actions include the same Role instance.  
Using identical copies of the Role does not cause a problem.

I've attached a simple test case to show the problem.  I can work on it 
more tomorrow, but if anyone wants to take a look at it before i get in, 
feel free.
This is the main thing preventing me from checking in things that enable 
authorization.

Eric
-------------- next part --------------
#!/usr/bin/python2

import os
import sys
import xml

from AccessGrid.hosting import Client
from AccessGrid.VenueServer import VenueServerIW
from AccessGrid.Platform import isWindows
from AccessGrid.Platform.Config import UserConfig
from AccessGrid.Toolkit import CmdlineApplication
from AccessGrid.Toolkit import Application, UserConfig

def TestActions():
    friendRole = AllowRole("friends")
    enemyRole =  DenyRole("enemies")
    #actionList = [Action("1", [friendRole, enemyRole]), Action("2", [friendRole, enemyRole])]
    # Works
    #actionList = [Action("1", [friendRole]), Action("2", [enemyRole])]
    # Works
    #import copy
    #actionList = [Action("1", [friendRole]), Action("2", [copy.deepcopy(friendRole)])]
    # Breaks
    actionList = [Action("1", [friendRole]), Action("2", [friendRole])]
    return actionList

app = CmdlineApplication()
app.Initialize()

from AccessGrid.Security.Action import Action
from AccessGrid.Security.Role import Role, AllowRole, DenyRole
from AccessGrid.Security.X509Subject import CreateSubjectFromString
from AccessGrid.hosting import Decorate, Reconstitute

#actionList = SampleActions()
actionList = TestActions()

print "Before Decorate:\n", actionList, "\n"
actionsDec = Decorate(actionList)
print "After Decorate:\n", actionsDec, "\n"
from SOAPpy import parseSOAP, parseSOAPRPC, buildSOAP
msg = buildSOAP(actionsDec)
print "after buildSOAP:\n", msg, "\n"
p = parseSOAPRPC(msg)
print "after parseSOAP:\n", p, "\n"
actions = Reconstitute(p)
print "after Reconstitute:\n"

# --- breaks here
for a in actions:
    print "Action:", a

# --- also would break after the following
domImpl = xml.dom.minidom.getDOMImplementation()
authDoc = domImpl.createDocument(xml.dom.minidom.EMPTY_NAMESPACE,
                                 "AuthorizationPolicy", None)
authP = authDoc.documentElement
                                                                                                                                              
for a in actions:
    authP.appendChild(a.ToXML(authDoc))
                                                                                                                                              
rval = authDoc.toxml()



More information about the ag-dev mailing list