Changeset 1497
- Timestamp:
- 12/09/06 17:12:30
- Files:
-
- branches/cherrypy-2.x/cherrypy/lib/cptools.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/cherrypy-2.x/cherrypy/lib/cptools.py
r1492 r1497 1 1 """Tools which both CherryPy and application developers may invoke.""" 2 2 3 import inspect4 3 import md5 5 4 import mimetools … … 25 24 """ 26 25 newfunc = decorator(func) 27 for (k,v) in inspect.getmembers(func):28 if not hasattr(newfunc, k ):29 setattr(newfunc, k , v)26 for key in dir(func): 27 if not hasattr(newfunc, key): 28 setattr(newfunc, key, getattr(func, key)) 30 29 return newfunc 31 30 … … 37 36 """ 38 37 obj_type = type(obj) 39 for (k,v) in inspect.getmembers(obj): 40 if hasattr(obj_type, k): # only deal with user-defined attributes 41 continue 42 if callable(v) and getattr(v, "exposed", False): 43 setattr(obj, k, decorate(v, decorator)) 44 decorateAll(v, decorator) 38 for key in dir(obj): 39 # only deal with user-defined attributes 40 if hasattr(obj_type, key): 41 value = getattr(obj, key) 42 if callable(value) and getattr(value, "exposed", False): 43 setattr(obj, key, decorate(value, decorator)) 44 decorateAll(value, decorator) 45 45 46 46

