mirror of
https://github.com/djohnlewis/stackdump
synced 2025-12-06 16:03:27 +00:00
Added an original copy of pysolr.py so the custom changes can be worked out.
This commit is contained in:
1
python/packages/formencode/util/__init__.py
Normal file
1
python/packages/formencode/util/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
#
|
||||
2665
python/packages/formencode/util/doctest24.py
Normal file
2665
python/packages/formencode/util/doctest24.py
Normal file
File diff suppressed because it is too large
Load Diff
38
python/packages/formencode/util/threadinglocal.py
Normal file
38
python/packages/formencode/util/threadinglocal.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
|
||||
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
try:
|
||||
import threading
|
||||
except ImportError:
|
||||
# No threads, so "thread local" means process-global
|
||||
class local(object):
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
local = threading.local
|
||||
except AttributeError: # Python < 2.4
|
||||
import thread
|
||||
class local(object):
|
||||
|
||||
def __init__(self):
|
||||
self.__dict__['__objs'] = {}
|
||||
|
||||
def __getattr__(self, attr, g=thread.get_ident):
|
||||
try:
|
||||
return self.__dict__['__objs'][g()][attr]
|
||||
except KeyError:
|
||||
raise AttributeError(
|
||||
"No variable %s defined for the thread %s"
|
||||
% (attr, g()))
|
||||
|
||||
def __setattr__(self, attr, value, g=thread.get_ident):
|
||||
self.__dict__['__objs'].setdefault(g(), {})[attr] = value
|
||||
|
||||
def __delattr__(self, attr, g=thread.get_ident):
|
||||
try:
|
||||
del self.__dict__['__objs'][g()][attr]
|
||||
except KeyError:
|
||||
raise AttributeError(
|
||||
"No variable %s defined for thread %s"
|
||||
% (attr, g()))
|
||||
|
||||
Reference in New Issue
Block a user