Andy Bulka writes:
How do I ensure that the string *contents* of my Zope object is passed to an external method, rather than passing the zope object itself?
E.g. if mydtmldoc is a DTML document with plain text inside it myFile is a file object with content-type plain text then when I call
<dtml-call "ProcessAstring1('a literal string')"> <dtml-call "ProcessAstring1(mydtmldoc)"> <dtml-call "ProcessAstring1(myFile)"> The easiest way is to work in your external method and let DTML pass what it likes:
def extMethod(string_or_object): s= string_or_object if hasattr(s,'read'): s= s.read() # now "s" is a string In DTML, it is much more difficult, as "read" is private for DTML objects. However, "PrincipiaSearchSource" is an accessible synonym for the "read" of DTML objects. I did not check the permissions of "OFS.File.read". You can use my DocFinder product <http://www.dieter.handshake.de/pyprojects/zope/DocFinder.html> to find out about it. Dieter