"""This Webfrontend is written in Spyce (Python Server Pages/http://spyce.sourceforge.net) and needs the file feedfinder.py from Mark Pilgrim.
Download it from http://diveintomark.org/projects/feed_finder/feedfinder.py .

You can test this script at http://www.goermezer.de

<head><title>RSS Feedfinder</title></head>
if request.getpost1('url') != None:
  print '<h1><center>RSS Feed results for', request.getpost1('url'), '</center></h1>'
  print '''<h1><center>Newsfeed finder</center></h1>
<p><center>This search engine searches for RSS feeds starting at any toplevel URL and crawls the whole site.</center></p>'''
<form method=get action="[[=request.uri('path')]]">
    <td>Main URL of site:</td>
   <td><input class="searchbox" name="url" type=text value="python.org" onBlur="if(this.value=='') this.value='python.org';" onFocus="if(this.value=='python.org') this.value='';"</td>
    <td><input type=submit value="Submit"></td>
url = request.getpost1('url')
if url != None:
    import feedfinder
    length = len(result)
    if result ==[]:
        print '<b>Sorry, no RSS Feed found.</b>'
        print '<b>Result:</b>'
        for i in range(length):
            print '<b><a href="'+result[i]+'">'+result[i]+'</a></b><br><br>'
        print """<p>