List Info

Thread: Re: Cherrypy and PyLucene




Re: Cherrypy and PyLucene
user name
2007-12-18 04:19:16
ok, the threading code is added to the tools wiki

Marc Jeurissen
University of Antwerp
Library automation

On Dec 13, 2007 6:27 PM, Robert Brewer < fumanchuaminus.org"> fumanchuaminus.org> wrote:

marc.jeurissengmail.com"> marc.jeurissengmail.com wrote:
>; As described in the tools wiki (http://tools.cherrypy.org/wiki/
> PyLucene) there is a problem in using PyLucene from CherryPy since
&gt; PyLucene uses a slightly different Thread class
> (PyLucene.PythonThread). The wiki suggests to modify the CherryPy
&gt; source code.
>
> Here I propose a solution to avoid this (inspired by the
> dummy_threading module mentioned to me by my colleague Richard
&gt; Philips).
> Import the following code on top of your application, before you
> import cherrypy. All subsequent 'import threading&#39; commands will
>; import this module and use the PyLucene.PythonThread class.
>; Be sure to replace the 'anet.explorator.exploratorthreading9; path by
> the name and path you give to the module.
&gt; It is necessary to fill the locals() table with the _names of the
> threading module since CherryPy addresses some _classes directly
&gt; (_Timer for example)
&gt;
>
&gt; exploratorthreading.py:
>
>;
> from threading import *
> from threading import __all__
>
> import threading
> all = dir(threading)
> for name in all:
>     if name[0] == '_'; and name[1] != '_';:
>         locals()[name] = eval('threading.%s' % name)
&gt;
> import sys
> del sys.modules['threading']
>
> try:
>     sys.modules['threading'] =
> sys.modules['anet.explorator.exploratorthreading&#39;]
> except:
>     sys.modules['threading'] = sys.modules['exploratorthreading']
>
> import PyLucene
&gt; class Thread(PyLucene.PythonThread):
&gt;     def __init__(self,  *args, **kwds):
&gt;         PyLucene.PythonThread.__init__(self,*args, **kwds)

Thanks, Marc! The tools wiki is open to all, so feel free to paste this
directly into http://tools.cherrypy.org/wiki/PyLucene


Robert Brewer
fumanchuaminus.org">fumanchuaminus.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users&quot; group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )