hmm
i figured it out my self :D

no more deferToThread !

use directly the PythonThread bubu :D

        def render_GET(self, request):
                #d = threads.deferToThread(self.processRequest, request)
                self.processRequest(request)
                return server.NOT_DONE_YET
                                
        def processRequest(self, request):
                t=PythonThread(target=self.doSearch, args=(request,))
                t.start()


and in doSearch at the end of the thread i call:
request.finish() to finish the Twisted Web output !

PyLucene rocks :D
very nice !

keep up the good work.


Friday, October 28, 2005, 12:23:48 PM, Catalin Constantin wrote:
> i am trying to run the search in a twisted web application.

> in my twisted resource i have:

>         def render_GET(self, request):
>                 d = threads.deferToThread(self.processRequest, request)
>                 return server.NOT_DONE_YET

> this seems not to be compatible with PyLucene.

> i also tryed running a PythonThread but i get another error:

> eg:
>         def processRequest(self, request):
>                 print "inside process Request"
>                 t=PythonThread(target=self.doSearch, args=(request,))
>                 print "Starting PyThread"
>                 t.start()
>                 t.join()
>                 print "Done PyThread"
>                 request.finish()

>   File "/usr/lib/python2.4/site-packages/PyLucene.py", line 3479, in start
>     assert (current.getName() == 'MainThread' or
> isinstance(current, PythonThread)), "PythonThread can only be
> started from main thread of from another PythonThread"
> exceptions.AssertionError: PythonThread can only be started from
> main thread of from another PythonThread


> Any help would be very appreciated.
> 10x.



-- 
Catalin Constantin
Bounce Software
http://www.bounce-software.com
http://www.cabanova.ro

_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to