summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamian Johnson <atagar@torproject.org>2014-12-05 13:25:48 -0800
committerDamian Johnson <atagar@torproject.org>2014-12-05 13:29:01 -0800
commit90bb28f44929bcb33b321eb51a27bb247c4ae6ab (patch)
tree77b320134013aa869b0b06172883dc694dd17b38
parentf6122a12f2de36116419e9953065ea8aaa983491 (diff)
Undefined _name() method on base Descriptor class
Methods for parsing router status entries expect a _name() method, but it was only defined on the RouterStatusEntry. In theory this sounds good, but Microdescriptors use this too. As a result we balk with an AttributeError when there's validation issues... https://trac.torproject.org/projects/tor/ticket/13904
-rw-r--r--docs/change_log.rst1
-rw-r--r--stem/descriptor/__init__.py3
-rw-r--r--stem/descriptor/microdescriptor.py3
3 files changed, 7 insertions, 0 deletions
diff --git a/docs/change_log.rst b/docs/change_log.rst
index e9fcac7f..132043be 100644
--- a/docs/change_log.rst
+++ b/docs/change_log.rst
@@ -61,6 +61,7 @@ The following are only available within Stem's `git repository
* Include '\*.new' files when reading from a Tor data directory (:trac:`13756`)
* Updated the authorities we list, `replacing turtles with longclaw <https://lists.torproject.org/pipermail/tor-talk/2014-November/035650.html>`_ and `updating gabelmoo's address <https://lists.torproject.org/pipermail/tor-talk/2014-September/034898.html>`_
* Noting if authorities are also a bandwidth authority or not
+ * Microdescriptor validation issues could result in an AttributeError (:trac:`13904`)
* **Utilities**
diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py
index e45ce1e5..15273388 100644
--- a/stem/descriptor/__init__.py
+++ b/stem/descriptor/__init__.py
@@ -367,6 +367,9 @@ class Descriptor(object):
def _set_archive_path(self, path):
self._archive_path = path
+ def _name(self, is_plural = False):
+ return str(type(self))
+
def __str__(self):
if stem.prereq.is_python_3():
return stem.util.str_tools._to_unicode(self._raw_contents)
diff --git a/stem/descriptor/microdescriptor.py b/stem/descriptor/microdescriptor.py
index c3d3db9e..4702b846 100644
--- a/stem/descriptor/microdescriptor.py
+++ b/stem/descriptor/microdescriptor.py
@@ -305,6 +305,9 @@ class Microdescriptor(Descriptor):
if "onion-key" != entries.keys()[0]:
raise ValueError("Microdescriptor must start with a 'onion-key' entry")
+ def _name(self, is_plural = False):
+ return 'microdescriptors' if is_plural else 'microdescriptor'
+
def _compare(self, other, method):
if not isinstance(other, Microdescriptor):
return False