[Tutor] psp_site mmods

Reed L. O'Brien reed at intersiege.com
Wed Jun 16 09:45:16 EDT 2004


I posted this to the mod_python mailing list the other day but there 
hasn't been a post that has gone up there since lunch on the 14th.  I 
odn't know if grisha is on vacation or what.  I really need halp to get 
this working though...  Or does this belong on the questions list?

I have been tasked to make a web interface to search (swish-e) and index 
of pdf's.  I have never done any programming (but have done some 
scripting) so I apologize in advance for any questions that may seen 
like common sense.  I feel like there will be many of them as this is 
very humbling to me.

I chose python to develop (and learn to program with) for numerous 
reasons.  I quickly found mod_python and chose that.  I saw the example 
site and thought it would be a nice simple site to modify (tries to 
conceal leeching noises).  I have it all up and running and somewhat 
modified but have reached an impass.

I have modified the three pages to be search, results and help.  I 
modified search_page.html to have text input and submit calls:

<form action="results/performSearch" method="POST">

I added it as a value passed (required by) to results (continued after 
bad code):

def results(req, searchWords):
     return _any_page(req, 'results')



         #def performSearch(searchWords):

     # make sure the user provided all the parameters
     if not (searchWords):
         return " Nothing to search for. Nothing Found."


     # do the search
     handle = SwishE.new('/usr/local/swish-e/index.swish-e')
     search = handle.search('')
     results = search.execute(searchWords)
     return [r.getproperty('swishdocpath') for r in results]

also I have the following in results_page.html:

<% print results %>


I have tried with it as a call to performSearch and directly to search. 
  I have tried with different indentations.  I have also tried including 
it in the page return, but either the page returns:

name error results not defined  ## wiith the <%psp%> tag in html
or:
as a blank formatted results page with a broken menu and images.

I could keep playing around but I figured it was time to put down my 
pride and ask the experts.  Any help is appreciated.

TIA
cheers,
reed (very newb programmer)

PS If (when) I get this working I will gladly roll it up  with a demo 
index and put it up as an example site with the original.

PSS:
FreeBSD 5.2.1
mod_python 3.1.3
python 2.3.4
SwishE 0.4





More information about the Tutor mailing list