<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.4630.0">
<TITLE>Parsed xml problems</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">I am using parsed xml … I have a parsed xml file in a folder. </FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I tried to lockdown my plone site, by following the link in<SPAN LANG="en-au"></SPAN></FONT><SPAN LANG="en-au"></SPAN><SPAN LANG="en-au"> </SPAN><A HREF="http://plone.org/documentation/howto/HowToCreateAPrivatePloneSite"><SPAN LANG="en-au"><U><FONT COLOR="#0000FF" FACE="Times New Roman">http://plone.org/documentation/howto/HowToCreateAPrivatePloneSite</FONT></U></SPAN></A><SPAN LANG="en-au"></SPAN></P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">This works great ( basically set a whole bunch of workflow state permissions to authenticated then run the update security settings) if you don't have a parsed xml file inside your site, but if you do you get a nastly little error </FONT></SPAN></P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">TypeError: hasattr expected 2 arguments, got 1</FONT></SPAN>
</P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">The even.log file says:</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">2004-07-15T16:12:32 ERROR(200) SiteError </FONT></SPAN><A HREF="http://localhost:5555/nerwa/portal_workflow/updateRoleMappings"><SPAN LANG="en-us"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">http://localhost:5555/nerwa/portal_workflow/updateRoleMappings</FONT></U></SPAN></A><SPAN LANG="en-us"></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Traceback (most recent call last):</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> File "C:\plone\Plone\Zope\lib\python\ZPublisher\Publish.py", line 100, in publish</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> request, bind=1)</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> File "C:\plone\Plone\Zope\lib\python\ZPublisher\mapply.py", line 88, in mapply</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> if debug is not None: return debug(object,args,context)</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> File "C:\plone\Plone\Zope\lib\python\ZPublisher\Publish.py", line 40, in call_object</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> result=apply(object,args) # Type s<cr> to step into published object.</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> File "C:\plone\Plone\Data\Products\CMFCore\WorkflowTool.py", line 490, in updateRoleMappings</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> count = self._recursiveUpdateRoleMappings(portal, wfs)</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> File "C:\plone\Plone\Data\Products\CMFCore\WorkflowTool.py", line 673, in _recursiveUpdateRoleMappings</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> count = count + self._recursiveUpdateRoleMappings(v, wfs)</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> File "C:\plone\Plone\Data\Products\CMFCore\WorkflowTool.py", line 673, in _recursiveUpdateRoleMappings</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> count = count + self._recursiveUpdateRoleMappings(v, wfs)</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> File "C:\plone\Plone\Data\Products\CMFCore\WorkflowTool.py", line 673, in _recursiveUpdateRoleMappings</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> count = count + self._recursiveUpdateRoleMappings(v, wfs)</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> File "C:\plone\Plone\Data\Products\CMFCore\WorkflowTool.py", line 669, in _recursiveUpdateRoleMappings</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> obs = ob.objectItems()</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> File "C:\plone\Plone\Zope\lib\python\Products\ParsedXML\ParsedXML.py", line 283, in objectItems</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> return ManageableDocument.objectItems(self, spec)</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> File "C:\plone\Plone\Zope\lib\python\Products\ParsedXML\ManageableDOM.py", line 241, in objectItems</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> for ob in self.objectValues(spec): a((ob.getId(), ob))</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> File "C:\plone\Plone\Zope\lib\python\Products\ParsedXML\ManageableDOM.py", line 193, in getId</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> if hasattr(self.aq_base):</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">TypeError: hasattr expected 2 arguments, got 1</FONT></SPAN>
</P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">I found the problem on line 193 it says :</FONT></SPAN>
</P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> # partial ObjectManagerItem interface</FONT></SPAN>
</P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> def getId(self):</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> "Return the id of the object as a string."</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> if hasattr(self.aq_base):</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> base = self.aq_base</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> else:</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> base = self</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> name=getattr(base, 'id', None)</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> if name is not None:</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> return name</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"> return self.tpURL()</FONT></SPAN>
</P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">You can see straightaway that someone is using hasattr with only one parameter. Not good is it.</FONT></SPAN>
</P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Any suggestions how to fix. The work around I have is just to remove my xml file, apply the security then put the xml file back … although this works it is not the ideal solution.</FONT></SPAN></P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Maybe I shouldn't be using parsed xml maybe there is a better python xml parser out there??</FONT></SPAN>
</P>
<P><SPAN LANG="en-us"><FONT COLOR="#0000FF" SIZE=1 FACE="Verdana">____________________________________________</FONT><BR>
<B></B><B><FONT COLOR="#0000CC" SIZE=2 FACE="Verdana">Peter Millar</FONT></B><FONT COLOR="#0000CC" SIZE=2 FACE="Verdana"></FONT><BR>
<B><FONT COLOR="#808080" SIZE=1 FACE="Verdana">Technical Project Manager</FONT></B><FONT COLOR="#808080" SIZE=1 FACE="Verdana"></FONT><BR>
<B><FONT COLOR="#0000CC" SIZE=1 FACE="Verdana">Parasyn Controls Pty Ltd</FONT></B><FONT COLOR="#0000CC" SIZE=1 FACE="Verdana"><BR>
<BR>
</FONT></SPAN><A HREF="mailto:Peter.Millar@Parasyn.com.au"><SPAN LANG="en-us"><U></U><U><FONT COLOR="#0000FF" SIZE=1 FACE="Verdana">Peter.Millar@Parasyn.com.au</FONT></U></SPAN></A><SPAN LANG="en-us"><FONT COLOR="#0000CC" SIZE=1 FACE="Verdana"><BR>
</FONT><FONT COLOR="#000000" SIZE=1 FACE="Verdana">T: 61 7 3396 6388<BR>
F: 61 7 3396 6299<BR>
45 Millenium Place, Tingalpa QLD 4173<BR>
PO Box 400 Cannon Hill QLD 4170</FONT><BR>
<B><FONT COLOR="#0000CC" SIZE=1 FACE="Verdana">Australia</FONT></B><FONT COLOR="#0000CC" SIZE=1 FACE="Verdana"><BR>
</FONT></SPAN><A HREF="http://www.parasyn.com.au/"><SPAN LANG="en-us"><U></U><U><FONT COLOR="#0000FF" SIZE=1 FACE="Verdana">www.parasyn.com.au</FONT></U></SPAN></A><SPAN LANG="en-us"><FONT COLOR="#0000CC" SIZE=1 FACE="Verdana"></FONT> </SPAN>
</P>
</BODY>
</HTML>