commit 152059f7d687c93326e039c954bbfa72a9356323 Author: Damian Johnson atagar@torproject.org Date: Mon May 28 15:43:35 2012 -0700
Adding an is_ok() method to controller responses
Method added by Ravi during his safecookie work. Stealing it a little early since I want it for refactoring that I'm doing. --- stem/socket.py | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/stem/socket.py b/stem/socket.py index 5abe902..a9e2068 100644 --- a/stem/socket.py +++ b/stem/socket.py @@ -408,6 +408,19 @@ class ControlMessage: self._parsed_content = parsed_content self._raw_content = raw_content
+ def is_ok(self): + """ + Checks if all of our lines have a 250 response. + + Returns: + True if all lines have a 250 response code, False otherwise + """ + + for code, _, _ in self._parsed_content: + if code != "250": return False + + return True + def content(self): """ Provides the parsed message content. These are entries of the form...
tor-commits@lists.torproject.org