[SQL-CVS] r4356 - in SQLObject/trunk/sqlobject: . util
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2011-03-15 14:29:30
|
Author: phd Date: Tue Mar 15 08:29:24 2011 New Revision: 4356 Log: Merged revision 4355 from branch 1.0: SQLObject stopped supporting Python 2.3 long ago. Modified: SQLObject/trunk/sqlobject/main.py SQLObject/trunk/sqlobject/util/threadinglocal.py Modified: SQLObject/trunk/sqlobject/main.py ============================================================================== --- SQLObject/trunk/sqlobject/main.py Tue Mar 15 08:27:03 2011 (r4355) +++ SQLObject/trunk/sqlobject/main.py Tue Mar 15 08:29:24 2011 (r4356) @@ -1,6 +1,6 @@ """ SQLObject 1.1 --------------- +------------- :author: Ian Bicking <ia...@co...> Modified: SQLObject/trunk/sqlobject/util/threadinglocal.py ============================================================================== --- SQLObject/trunk/sqlobject/util/threadinglocal.py Tue Mar 15 08:27:03 2011 (r4355) +++ SQLObject/trunk/sqlobject/util/threadinglocal.py Tue Mar 15 08:29:24 2011 (r4356) @@ -1,35 +1,6 @@ try: - import threading + from threading import local except ImportError: # No threads, so "thread local" means process-global class local(object): pass -else: - try: - local = threading.local - except AttributeError: - # Added in 2.4, but now we'll have to define it ourselves - 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())) |