use hasattr
This commit is contained in:
parent
5c344f7efa
commit
9bc69f7de9
|
@ -65,7 +65,6 @@ class Request(dict):
|
||||||
self.parsed_files = None
|
self.parsed_files = None
|
||||||
self.parsed_args = None
|
self.parsed_args = None
|
||||||
self._cookies = None
|
self._cookies = None
|
||||||
self._ip = None
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def json(self):
|
def json(self):
|
||||||
|
@ -143,7 +142,7 @@ class Request(dict):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ip(self):
|
def ip(self):
|
||||||
if self._ip is None:
|
if not hasattr(self, '_ip'):
|
||||||
self._ip = self.transport.get_extra_info('peername')
|
self._ip = self.transport.get_extra_info('peername')
|
||||||
return self._ip
|
return self._ip
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user