[Zope] External Method Problem

Dennis Allison allison@sumeru.stanford.EDU
Sun, 14 Apr 2002 13:54:10 -0700 (PDT)


I am having a problem getting this external method to function.
The external method is called from a DTML method which is the 
action for a form--the DTML method is used to delegate the action
to this External Method.

Basically this External Method takes some information from a form, munges
it a bit, puts it into an XML wrapper and then wants to store it as a
ParsedXML object in the target folder.  It needs to be an external method
because re.split() is not "safe".

-------the  method in abbreviated  form is as follows ---------------

def manifest2xml( self, str, targetfolder, REQUEST, RESPONSE ):
   import re
   from Products.ParsedXML.StrIO import StringIO
   from Products.ParsedXML.ParsedXML import manage_addParsedXML
   import OFS.ObjectManager
  
#   <<code here to munge str passed in as a parameter from form>>
#   <<output is a list of strings called xmlstr>>    
#   <<the list output is put into a Unicode-safe file-like object>>

   sfd = StringIO( '\n'.join( xmlstr ))
   self.manage_addProduct['OFSP'].manage_addParsedXML( 'manifest_xml',
title='manifest', file=sfd )

-------- end of method --------------------------

The diagnostic reported is an attribute error for manage_addParsedXML.

The DTML method that calls this External Method is just a nest of
dtml-with statements followed by the call

<dtml-call expr="manifest2xml(textfield, 'targetdir', REQUEST, RESPONSE)">

A check of the Control Panel indicates that the ParsedXML product is
properly installed.  And, it is possible to use the product from the
manage screens.

I have verified by printing that both textfield and target are properly
set.  I believe self is also properly set--the signature of the External
Method declartion matches that of the call so the local self at the source
of the call is (presumably) provided.

So, I am clearly confused.  Anyone have a suggestion/pointer.  -dra