Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F7172175
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/sylk/tls.py b/sylk/tls.py
index 066c6dd..a147a85 100644
--- a/sylk/tls.py
+++ b/sylk/tls.py
@@ -1,49 +1,49 @@
from application import log
from application.process import process
from gnutls.crypto import X509Certificate, X509PrivateKey
__all__ = 'Certificate', 'PrivateKey'
-def file_content(file):
- path = process.configuration.file(file)
+def file_content(filename):
+ path = process.configuration.file(filename)
if path is None:
- raise Exception("File '%s' does not exist" % file)
+ raise Exception("File '%s' does not exist" % filename)
try:
f = open(path, 'rt')
except Exception:
- raise Exception("File '%s' could not be open" % file)
+ raise Exception("File '%s' could not be open" % filename)
try:
return f.read()
finally:
f.close()
class Certificate(object):
"""Configuration data type. Used to create a gnutls.crypto.X509Certificate object
from a file given in the configuration file."""
def __new__(cls, value):
if isinstance(value, basestring):
try:
return X509Certificate(file_content(value))
except Exception as e:
log.warn("Certificate file '%s' could not be loaded: %s" % (value, str(e)))
return None
else:
raise TypeError('value should be a string')
class PrivateKey(object):
"""Configuration data type. Used to create a gnutls.crypto.X509PrivateKey object
from a file given in the configuration file."""
def __new__(cls, value):
if isinstance(value, basestring):
try:
return X509PrivateKey(file_content(value))
except Exception as e:
log.warn("Private key file '%s' could not be loaded: %s" % (value, str(e)))
return None
else:
raise TypeError('value should be a string')
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Nov 26, 7:42 AM (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3414531
Default Alt Text
(1 KB)
Attached To
Mode
rSYLK SylkServer
Attached
Detach File
Event Timeline
Log In to Comment