Including HTML from another server's file into a dtml method or document
Hey all, Does anyone know how to include a file from another server into a dtml method or doc? The 'other' server can be the local file system, or (what I want) another server out there. I want to be able to grab the html from the file and display it in my dtml method. Something similiar to ColdFusion's <CFHTTP> tag. Maybe a simple syntax or a product could do this? Send me all ideas you have. I'd appreciate it. I tried searching the EGroups Zope archive, but to no avail. Thanks in advance, Tommy Innovation: The Best Way To Predict The Future ... Is To Create It.
Write an external method takes the url as argument and use the urllib module to fetch the URL and returns its content. Something like that (untested) should work: def fetchurl(url): import urllib return urllib.urlopen(url).read() and inside DTML you can use <dtml-var "fetchurl('http://www.zope.org')"> Andreas ----- Original Message ----- From: "Tommy Johnson" <tommy@7x.com> To: "Zope List" <zope@zope.org> Sent: Mittwoch, 1. August 2001 18:38 Subject: [Zope] Including HTML from another server's file into a dtml method or document
Hey all,
Does anyone know how to include a file from another server into a dtml method or doc? The 'other' server can be the local file system, or (what I want) another server out there. I want to be able to grab the html from the file and display it in my dtml method.
Something similiar to ColdFusion's <CFHTTP> tag. Maybe a simple syntax or a product could do this? Send me all ideas you have. I'd appreciate it. I tried searching the EGroups Zope archive, but to no avail.
Thanks in advance,
Tommy
Innovation: The Best Way To Predict The Future ... Is To Create It.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Thursday 02 August 2001 07:38, Tommy Johnson wrote:
Hey all,
Does anyone know how to include a file from another server into a dtml method or doc? The 'other' server can be the local file system, or (what I want) another server out there. I want to be able to grab the html from the file and display it in my dtml method.
Something similiar to ColdFusion's <CFHTTP> tag. Maybe a simple syntax or a product could do this? Send me all ideas you have. I'd appreciate it. I tried searching the EGroups Zope archive, but to no avail.
Thanks in advance,
Tommy
have a look at http://www.zope.org/Members/kedai/KebasData there's also a howto
Hi, --On Mittwoch, 1. August 2001 15:38 -0800 Tommy Johnson <tommy@7x.com> wrote: I use an external method like this: from ZPublisher import Client def web_client(url = 'http://some.default.url', username = None, password = None, **kw): '''access http servers''' class gen_res: __allow_access_to_unprotected_subobjects__=1 f=gen_res() if kw: f.headers,f.body=Client.call(url,username,password,kw) else: f.headers,f.body=Client.call(url,username,password) return(f) And call it from DTML or ZPT like this: <dtml-with expr="web_client(url)"> <dtml-var body> </dtml-with> or <div tal:define="extcontent python:context.web_client(url)" tal:replace="extcontent/body"> The external method returns an object with the headers and body, where heraders are the HTTP headers to get some informations. HTH Tino Wildenhain
Hey all,
Does anyone know how to include a file from another server into a dtml method or doc? The 'other' server can be the local file system, or (what I want) another server out there. I want to be able to grab the html from the file and display it in my dtml method.
Something similiar to ColdFusion's <CFHTTP> tag. Maybe a simple syntax or a product could do this? Send me all ideas you have. I'd appreciate it. I tried searching the EGroups Zope archive, but to no avail.
Thanks in advance,
Tommy
Innovation: The Best Way To Predict The Future ... Is To Create It.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (4)
-
Andreas Jung -
bak -
Tino Wildenhain -
Tommy Johnson