[Zope] Including HTML from another server's file into a dtml
method or document
Tino Wildenhain
tino@wildenhain.de
Thu, 02 Aug 2001 10:46:03 +0200
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 )