from mod_python import apache from xml.dom.minidom import getDOMImplementation, parse, parseString from xml.dom import minidom import os import urllib #******************************************************************** #************************Main function******************************* #**************This function returns list of cities****************** #******************************************************************** def index(req): req.content_type= "text/xml; charset=utf-8" #req.content_type= "text/xml" form = req.form if form.has_key('waddress'): address = form.getfirst('waddress') #address = "http://users.jyu.fi/~hoke/wwwsovellukset/8/forecast.xml" filename = os.path.join(os.path.dirname(req.filename), 'log.txt') file = open(filename, 'w') file.write(address) #.encode("ISO-8859-1")) file.close() dom = minidom.parse(urllib.urlopen(address)) req.write( dom.toxml("utf-8") ) #return