comparison MoinMoin/support/werkzeug/contrib/testtools.py @ 5801:8de563c487be

upgrade werkzeug to 0.8.1, document current bundled version and current minimum requirement (0.6, for py 2.7 compatibility)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 01 Dec 2011 01:34:45 +0100
parents 246ba4eecab2
children 9f12f41504fc
comparison
equal deleted inserted replaced
5800:4ab3c578e44b 5801:8de563c487be
7 7
8 `TestResponse` 8 `TestResponse`
9 A response wrapper which adds various cached attributes for 9 A response wrapper which adds various cached attributes for
10 simplified assertions on various content types. 10 simplified assertions on various content types.
11 11
12 :copyright: (c) 2009 by the Werkzeug Team, see AUTHORS for more details. 12 :copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.
13 :license: BSD, see LICENSE for more details. 13 :license: BSD, see LICENSE for more details.
14 """ 14 """
15 from werkzeug import Response, cached_property, import_string 15 from werkzeug.utils import cached_property, import_string
16 from werkzeug.wrappers import Response
17
18 from warnings import warn
19 warn(DeprecationWarning('werkzeug.contrib.testtools is deprecated and '
20 'will be removed with Werkzeug 1.0'))
16 21
17 22
18 class ContentAccessors(object): 23 class ContentAccessors(object):
19 """ 24 """
20 A mixin class for response objects that provides a couple of useful 25 A mixin class for response objects that provides a couple of useful
54 """Get the result of simplejson.loads if possible.""" 59 """Get the result of simplejson.loads if possible."""
55 if 'json' not in self.mimetype: 60 if 'json' not in self.mimetype:
56 raise AttributeError('Not a JSON response') 61 raise AttributeError('Not a JSON response')
57 try: 62 try:
58 from simplejson import loads 63 from simplejson import loads
59 except: 64 except ImportError:
60 from json import loads 65 from json import loads
61 return loads(self.data) 66 return loads(self.data)
62 json = cached_property(json) 67 json = cached_property(json)
63 68
64 69