[Zope] XML - Setting Object Security Universally?

J. Joy kyroraz@yahoo.com
Tue, 9 Jul 2002 15:45:38 -0700 (PDT)


This is more on the stuff that I posted earlier about the External Methods....

This is my sample XML file:

<UserRequest>
  <RequestHeader>
    <VERSION_2_0 />
    <Authentication>
    <PartnerID>123</PartnerID>
    <PartnerPassword>abc</PartnerPassword>
    </Authentication>

  </RequestHeader>
  <Body>
  <ModifyBusiness>
    <AuthorizedAgent SystemUserType="customer">
      <SystemUser>
        <UserID>456</UserID>
        <Password>def</Password>
      </SystemUser>

    </AuthorizedAgent>
    <CustomerID>789</CustomerID>
  </ModifyBusiness>
  </Body>
</UserRequest>

And I am trying to parse it such that I can <dtml-in> to the elements in question to extract it. 
Looking at XMLParse and such, a document already has to exist, and I want to be able to pass XML
through a variable and have it processed, so therefore I am using an *external method*.  However,
by the way that it is set up, each object is within an object, e.g. UserRequest has a
RequestHeader object in it and so forth.  I can extract it just fine, but I find that each object
is not a subobject.

My code:
import gnosis.xml.objectify as xp
from AccessControl import ClassSecurityInfo
from Acquisition import Implicit
import Globals

xp.__allow_access_to_unprotected_subobjects__=1

__allow_access_to_unprotected_subobjects__=1

def xml_to_py(self):

	self.__allow_access_to_unprotected_subobjects__=1
	xp.__allow_access_to_unprotected_subobjects__=1  

	object = xp.XML_Objectify('/tmp/sample.xml')
	object.__allow_access_to_unprotected_subobjects__=1
	returning = object._PyObject.UserRequest
	returning.__allow_access_to_unprotected_subobjects__=1
	returning.RequestHeader.__allow_access_to_unprotected_subobjects__=1
	## print dir(returning.RequestHeader)
	return (returning)

---

In order to keep the system from preventing Unauthorized errors and the Login-Forever sequence
going, I have to set each object within the object to allow access to unprotected subobjects.

Is there a better way to do this or a way to set every single one of these?

Jason



__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com