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
On Sun, 14 Apr 2002, Dennis Allison wrote:
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
A bit more information, possibly not clear from my initial posting. In the context of the manifest2xml External Method: self points to the folder in which the material is to be added. For example, self.title_or_id() produces the correct value. str is the string to be processed and is passed in correctly. targetfolder is a string used during the processing of str and is not part of anything here. REQUEST and RESPONSE are passed in but not used in the current implementation. -dra
Dennis Allison writes:
.... 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 ) The normal registration would put "manage_addParsedXML" into the product "ParsedXML" not in "OFSP".
Try this. Dieter
participants (2)
-
Dennis Allison -
Dieter Maurer