Changeset 1235
- Timestamp:
- 08/11/06 15:27:04
- Files:
-
- trunk/cherrypy/_cptools.py (modified) (2 diffs)
- trunk/cherrypy/test/test_tools.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cptools.py
r1232 r1235 63 63 return conf 64 64 65 def __call__(self, * *kwargs):65 def __call__(self, *args, **kwargs): 66 66 """Compile-time decorator (turn on the tool in config). 67 67 … … 73 73 whats_my_base.exposed = True 74 74 """ 75 if args: 76 raise TypeError("The %r Tool does not accept positional " 77 "arguments; you must use keyword arguments." 78 % self._name) 75 79 def wrapper(f): 76 80 if not hasattr(f, "_cp_config"): trunk/cherrypy/test/test_tools.py
r1147 r1235 85 85 pipe.exposed = True 86 86 pipe._cp_config = {'hooks.before_request_body': pipe_body} 87 88 # Multiple decorators; include kwargs just for fun. 89 def decorated_euro(self): 90 yield u"Hello," 91 yield u"world" 92 yield europoundUnicode 93 decorated_euro.exposed = True 94 decorated_euro = tools.gzip(compress_level=6)(decorated_euro) 95 decorated_euro = tools.encode(errors='ignore')(decorated_euro) 87 96 88 97 root = Root() … … 222 231 self.getPage("/euro", headers=[("Accept-Encoding", "gzip")]) 223 232 self.assertInBody(zbuf.getvalue()[:3]) 233 234 zbuf = StringIO.StringIO() 235 zfile = gzip.GzipFile(mode='wb', fileobj=zbuf, compresslevel=6) 236 zfile.write(expectedResult) 237 zfile.close() 238 239 self.getPage("/decorated_euro", headers=[("Accept-Encoding", "gzip")]) 240 self.assertInBody(zbuf.getvalue()[:3]) 224 241 225 242 def testBareHooks(self):

