[SQL-CVS] r701 - trunk/SQLObject/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2005-04-01 22:41:19
|
Author: ianb Date: 2005-04-01 22:41:16 +0000 (Fri, 01 Apr 2005) New Revision: 701 Removed: trunk/SQLObject/sqlobject/threadinglocal.py Log: and deleting... Deleted: trunk/SQLObject/sqlobject/threadinglocal.py =================================================================== --- trunk/SQLObject/sqlobject/threadinglocal.py 2005-04-01 22:40:51 UTC (rev 700) +++ trunk/SQLObject/sqlobject/threadinglocal.py 2005-04-01 22:41:16 UTC (rev 701) @@ -1,35 +0,0 @@ -try: - import threading -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())) |