[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [oonib/master] Don't override errors set via class attributes



commit 93cf891c7d77795e59c0763b499d234d3d54992f
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Sat Jan 24 15:21:03 2015 +0100

    Don't override errors set via class attributes
---
 oonib/errors.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/oonib/errors.py b/oonib/errors.py
index 64b179f..6d97190 100644
--- a/oonib/errors.py
+++ b/oonib/errors.py
@@ -2,9 +2,14 @@ from cyclone.web import HTTPError
 
 
 class OONIBError(HTTPError):
-    def __init__(self, status_code=500, log_message='oonib-error'):
-        self.status_code = status_code
-        self.log_message = log_message
+    status_code = 500
+    log_message = 'oonib-error'
+
+    def __init__(self, status_code=None, log_message=None):
+        if status_code:
+            self.status_code = status_code
+        if log_message:
+            self.log_message = log_message
 
 
 class InvalidRequest(OONIBError):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits