[Zope] Help eMail this page to a friend
Spicklemire, Jerry
Jerry.Spicklemire@IFLYATA.COM
Sat, 24 Feb 2001 07:41:08 -0500
Loren said:
> Therein is the problem:
> how to get Zope to render the DTML and make an HTML page.
You might try something like this, in an external method,
to capture the HTML, and then insert it as the body of the
message:
#! python
"""
urlgrabr.py is a simple script to hit an URL,
retrieve the generated output, and manipulate
it, including stripping out extraneous line
feed characters.
e.g. save Web page as a file,
python urlgrabr.py someURL file=somename.htm
based on parameters.
Default is simply to call the URL, and exit, dumping all data.
"""
import urllib
import sys
import string
c_url = sys.argv[1]
c_action = None
u_url = urllib.urlopen(c_url)
if len(sys.argv) > 2 :
c_action = sys.argv[2]
if string.lower(c_action[:5]) == "file=" :
f_action = open(c_action[5:], "w") # file name
for l in u_url.readlines() :
if string.strip(l[:-1]) :
f_action.write(l)
f_action.close()