[tor-commits] [ooni-probe/master] * Added a couple basic Exception classes to ooni.utils.net

isis at torproject.org isis at torproject.org
Thu Nov 1 12:14:01 UTC 2012


commit 187356a5ff61985b8691615334fa124ecd61ceab
Author: Isis Lovecruft <isis at torproject.org>
Date:   Wed Oct 31 16:00:39 2012 +0000

    * Added a couple basic Exception classes to ooni.utils.net
---
 ooni/utils/net.py |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/ooni/utils/net.py b/ooni/utils/net.py
index 218a74a..46c29e5 100644
--- a/ooni/utils/net.py
+++ b/ooni/utils/net.py
@@ -1,4 +1,29 @@
+# -*- encoding: utf-8 -*-
+#
+# net.py
+# --------
+# OONI utilities for network infrastructure and hardware.
+#
+# :authors: Isis Lovecruft, Arturo Filasto
+# :version: 0.0.1-pre-alpha
+# :license: (c) 2012 Isis Lovecruft, Arturo Filasto
+#           see attached LICENCE file
+
+
 def getClientAddress():
     address = {'asn': 'REPLACE_ME',
                'ip': 'REPLACE_ME'}
     return address
+
+
+class PermissionsError(SystemExit):
+    def __init__(self, *args, **kwargs):
+        if not args and not kwargs:
+            pe = "This test requires admin or root privileges to run. Exiting..."
+            super(PermissionsError, self).__init__(pe, *args, **kwargs)
+        else:
+            super(PermissionsError, self).__init__(*args, **kwargs)
+
+class IfaceError(SystemExit):
+    def __init__(self, *args, **kwargs):
+        super(IfaceError, self).__init__(*args, **kwargs)





More information about the tor-commits mailing list