call .text from .body_as_unicode() and not the other way around

This commit is contained in:
Mikhail Korobov 2016-01-28 00:59:27 +05:00
parent 394b991e3a
commit 3e080c3c52
1 changed files with 6 additions and 6 deletions

View File

@ -59,7 +59,12 @@ class TextResponse(Response):
def body_as_unicode(self):
"""Return body as unicode"""
# check for self.encoding before _cached_ubody just in
return self.text
@property
def text(self):
""" Body as unicode """
# access self.encoding before _cached_ubody to make sure
# _body_inferred_encoding is called
benc = self.encoding
if self._cached_ubody is None:
@ -67,11 +72,6 @@ class TextResponse(Response):
self._cached_ubody = html_to_unicode(charset, self.body)[1]
return self._cached_ubody
@property
def text(self):
""" Body as unicode """
return self.body_as_unicode()
def urljoin(self, url):
"""Join this Response's url with a possible relative url to form an
absolute interpretation of the latter."""