Commit ac9406a6 authored by juga's avatar juga
Browse files

relaylist: remove assertions that fail measurement

When the descriptor or network status of a relay was not obtained,
some attributes can't be obtained it can be return None instead
of failing the measurement.
Also, there's no need for hasattr when getattr can just return
None as default.

Closes #28870. Bugfix v0.4.0
parent ee64d76d
......@@ -42,14 +42,12 @@ class Relay:
def _from_desc(self, attr):
if not self._desc:
return None
assert hasattr(self._desc, attr)
return getattr(self._desc, attr)
return getattr(self._desc, attr, None)
def _from_ns(self, attr):
if not self._ns:
return None
assert hasattr(self._ns, attr)
return getattr(self._ns, attr)
return getattr(self._ns, attr, None)
def nickname(self):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment