[mod_python] How to call a webpage on the same server?

berry groenendijk berry.groenendijk at gmail.com
Mon May 30 17:26:33 EDT 2005


Hi!

Strictly speaking this is not a mod_python question. Please accept my 
apologies. Still I hope somebody can give me some hints. 

I am using mod_python 3.1.3 with mod_python servlets. I am experimenting 
with a REST-style interface to my website.

This is the situation. Page A in my website returns a RSS XML file. I want 
to use this output on page B in the same website. To present page B to the 
user I do a little server side conversion to HTML. The problem is: this is 
very slow! My guess is that it has to do with the way I call page A.

Here is part of the code of page B:

import os
import urllib
from cElementTree import iterparse

import _SitePage as sitepage
import _Config as config

class keywordshtml2(sitepage.SitePage):

 def write_content(self):
 
 url_keywords = "http://%s/keywords" % self.req.hostname
 
 self.writeln('<h1>List of articles by keyword</h1>')
 self.writeln("<p>Available keywords:")
 for event, elem in iterparse(urllib.urlopen(url_keywords)):
 if elem.tag == "item":
 self.writeln("<a href='#%(x)s'>%(x)s</a>, " % ({'x': elem.findtext
("title")}))
 elem.clear()
 self.writeln("</p>")
 
Is there a better way to call page A from within page B?

-- 
Berry Groenendijk
http://www.bersie.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050530/c76b8de3/attachment.html


More information about the Mod_python mailing list