[Pkg-privacy-commits] [pyptlib] 13/136: Moved config classes into config module
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:25:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository pyptlib.
commit 13c201467c34ee3ba030d3cd82ba061847d332f7
Author: Brandon Wiley <brandon at blanu.net>
Date: Mon Jun 4 14:48:57 2012 -0500
Moved config classes into config module
---
src/pyptlib/config/client.py | 2 ++
src/pyptlib/config/config.py | 18 +++++++++++-------
src/pyptlib/config/server.py | 4 ++++
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/pyptlib/config/client.py b/src/pyptlib/config/client.py
index 40c7a96..1fc130c 100644
--- a/src/pyptlib/config/client.py
+++ b/src/pyptlib/config/client.py
@@ -12,6 +12,8 @@ __docformat__ = 'restructuredtext'
class ClientConfig(Config):
clientTransports=[] # TOR_PT_CLIENT_TRANSPORTS
+ #Public methods
+
def __init__(self): # throws EnvError
Config.__init__(self)
diff --git a/src/pyptlib/config/config.py b/src/pyptlib/config/config.py
index d902d0f..f75d1b7 100644
--- a/src/pyptlib/config/config.py
+++ b/src/pyptlib/config/config.py
@@ -11,19 +11,15 @@ class Config:
managedTransportVer=[] # TOR_PT_MANAGED_TRANSPORT_VER
allTransportsEnabled=False
+ #Public methods
+
def __init__(self): # throws EnvError
stateLocation=self.get('TOR_PT_STATE_LOCATION')
managedTransportVer=self.get('TOR_PT_MANAGED_TRANSPORT_VER').split(',')
if '*' in managedTransportVer:
allTransportsEnabled=True
managedTransportVer.remove('*')
-
- def get(self, key):
- if key in os.environ:
- return os.environ[key]
- else:
- raise EnvException()
-
+
# Returns a string representing the path to the state storage directory (which may not exist, but should be creatable) reported by Tor
def getStateLocation(self):
return stateLocation
@@ -54,6 +50,14 @@ class Config:
# Write a message to stdout specifying that none of the specified configuration protocol versions are supported
def writeVersionError(self): # VERSION-ERROR
print('VERSION-ERROR no-version')
+
+ # Private methods
+
+ def get(self, key):
+ if key in os.environ:
+ return os.environ[key]
+ else:
+ raise EnvException()
# Exception thrown when there is an error parsing the configuration parameters provided by Tor in environment variables
class EnvException(Exception):
diff --git a/src/pyptlib/config/server.py b/src/pyptlib/config/server.py
index 719e850..3d076d9 100644
--- a/src/pyptlib/config/server.py
+++ b/src/pyptlib/config/server.py
@@ -14,6 +14,8 @@ class ServerConfig(Config):
serverBindAddr={} # TOR_PT_SERVER_BINADDR
serverTransports=[] # TOR_PT_SERVER_TRANSPORTS
+ #Public methods
+
def __init__(self): # throws EnvError
Config.__init__(self)
@@ -66,6 +68,8 @@ class MethodOptions:
declare={} # DECLARE
useExtendedPort=False # USE-EXTENDED-PORT
+ #Public methods
+
def __init__(self):
pass
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/pyptlib.git
More information about the Pkg-privacy-commits
mailing list