Changeset 1093
- Timestamp:
- 05/07/06 00:52:18
- Files:
-
- trunk/cherrypy/__init__.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/__init__.py
r1092 r1093 3 3 __version__ = '3.0.0alpha' 4 4 5 import datetime6 5 import sys 7 6 import types … … 28 27 from cherrypy._cpthreadinglocal import local 29 28 30 # Create a threadlocal object to hold the request and response31 # objects. In this way, we can easily dump those objects when 32 # we stop/start a new HTTP conversation, yet still refer to33 # them as module-level globalsin a thread-safe way.29 # Create a threadlocal object to hold the request, response, and other 30 # objects. In this way, we can easily dump those objects when we stop/start 31 # a new HTTP conversation, yet still refer to them as module-level globals 32 # in a thread-safe way. 34 33 serving = local() 35 34 … … 40 39 41 40 def __getattr__(self, name): 42 childobject = getattr(serving, self.__attrname__) 41 try: 42 childobject = getattr(serving, self.__attrname__) 43 except AttributeError: 44 raise AttributeError("cherrypy.%s has no properties outside of " 45 "an HTTP request." % self.__attrname__) 43 46 return getattr(childobject, name) 44 47 45 48 def __setattr__(self, name, value): 46 childobject = getattr(serving, self.__attrname__) 49 try: 50 childobject = getattr(serving, self.__attrname__) 51 except AttributeError: 52 raise AttributeError("cherrypy.%s has no properties outside of " 53 "an HTTP request." % self.__attrname__) 47 54 setattr(childobject, name, value) 48 55 49 56 def __delattr__(self, name): 50 childobject = getattr(serving, self.__attrname__) 57 try: 58 childobject = getattr(serving, self.__attrname__) 59 except AttributeError: 60 raise AttributeError("cherrypy.%s has no properties outside of " 61 "an HTTP request." % self.__attrname__) 51 62 delattr(childobject, name) 52 63 … … 83 94 return expose_ 84 95 96 def set_config(**kwargs): 97 """Decorator to set _cp_config using the given kwargs.""" 98 def wrapper(f): 99 f._cp_config = kwargs 100 return f 101 return wrapper 102 85 103 def log(msg='', context='', severity=0, traceback=False): 86 104 """Syntactic sugar for writing to the (error) log."""

