Re: [Tutor] psp_site mmods
magnus at thinkware.se
Wed Jun 23 14:47:19 EDT 2004
Reed L. O'Brien wrote:
> 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]
I'm not sure what this is meant to do, but you should be aware
that everything after the line "return _any_page(req, 'results')"
will be ignored by Python. Since you have an uncondional return
on that line, any call to the function "results" will end there,
and because of it's indentation, the code below is considered to
be a part of the "results" function.
If you are uncertain about indentation, make sure that you
consistently use spaces *or* tabs for indentation, never mix them.
Most Pythonistas use four spaces for indentaion.
> I could keep playing around but I figured it was time to put down my
> pride and ask the experts. Any help is appreciated.
> reed (very newb programmer)
Did you get an unmodified version if the demo to work? Make sure
that you do.
Start with that and try to change it in *really* small steps.
Don't add any more features if you've broken your code. Always
make it work before you go to the next step. I don't know if
anyone here has used mod_python and psp (I haven't), but if
you have a working example, and then can show that it broke
when you made a tiny change, we can probably help you sort that
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/ mailto:magnus at thinkware.se
More information about the Tutor