summaryrefslogtreecommitdiff
path: root/lib/thandy/util.py
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-07-25 15:13:04 -0400
committerNick Mathewson <nickm@torproject.org>2010-07-25 16:57:24 -0400
commitbbb6cb5fe6a61aa0975dcd9df11f9f648f6abba2 (patch)
treec97f164ecc7811ef3d6ba07d51a8c05a695d222d /lib/thandy/util.py
parent5f2d07ce78e6443592f84a803fe2adced49ada39 (diff)
More unit tests and documentation for the Thandy code
Diffstat (limited to 'lib/thandy/util.py')
-rw-r--r--lib/thandy/util.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/thandy/util.py b/lib/thandy/util.py
index 90f251f..29c7b87 100644
--- a/lib/thandy/util.py
+++ b/lib/thandy/util.py
@@ -19,6 +19,11 @@ import thandy.master_keys
_jsonModule = None
def importJSON():
+ """Load and return the json module.
+
+ When everybody has Python 2.6 or later, we can just replace this with
+ 'import json; return json'
+ """
global _jsonModule
if _jsonModule is not None:
return _jsonModule
@@ -200,6 +205,7 @@ def getRegistryValue(keyname):
_controlLog = logging.getLogger("thandy-ctrl")
def formatLogString(s):
+ """DOCDOC"""
s = '"%s"' % re.sub(r'(["\\])', r'\\\1', s)
s = s.replace("\n", "\\n")
return s