From d5c630393aedc4140960bbb121ce027cb8e02f6e Mon Sep 17 00:00:00 2001
From: age
Date: Tue, 31 Jul 2007 09:59:16 +0000
Subject: [PATCH] * better checks * moved expose code to plugin *
download-buttons are not working as expected atm (needs change in plugin
download mechanism)
---
plugins/logs/logs.py | 29 ++++++++++++++++++++++-------
plugins/logs/show_log.cs | 2 +-
src/cryptobox/web/sites.py | 15 ---------------
3 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/plugins/logs/logs.py b/plugins/logs/logs.py
index 5910e3c..88afc91 100644
--- a/plugins/logs/logs.py
+++ b/plugins/logs/logs.py
@@ -73,18 +73,19 @@ class logs(cryptobox.plugins.base.CryptoBoxPlugin):
self.cbox.prefs["Log"]["Destination"].lower()
## this generates more download buttons if the files are available
- try:
- syslogfile = self.defaults["syslogfile"].lower()
- if os.access(syslogfile, os.R_OK):
+ if "syslogfile" in self.defaults:
+ try:
+ syslogfile = self.defaults["syslogfile"]
+ except KeyError:
+ self.cbox.log.error("could not evaluate the config setting: "
+ + "[logs]->syslogfile")
+ if syslogfile and os.access(syslogfile, os.R_OK):
self.cbox.log.info("[logs]->syslogfile: '%s' will be exported" % syslogfile)
self.hdf[self.hdf_prefix + "syslogfile"] = "readable"
+ self.cbox.prefs["Log"]["syslogfile"] = syslogfile
else:
self.cbox.log.warn("[logs]->syslogfile: '%s' is not readable for cryptobox user" % syslogfile)
self.hdf[self.hdf_prefix + "syslogfile"] = "not readable"
- except KeyError:
- self.cbox.log.error(
- "could not evaluate the config setting: "
- + "[logs]->syslogfile")
return "show_log"
@@ -94,12 +95,26 @@ class logs(cryptobox.plugins.base.CryptoBoxPlugin):
**kargs are necessary - we have to ignore 'weblang' and so on ...
"""
+ ##TODO: check the download url to know which file is wanted
+ if self.cbox.prefs["Log"]["syslogfile"]:
+ try:
+ syslogfile = self.cbox.prefs["Log"]["syslogfile"]
+ except KeyError:
+ self.cbox.log.error("could not evaluate the config setting: "
+ + "[logs]->syslogfile %s")
+ if syslogfile and os.access(syslogfile, os.R_OK):
+ return cherrypy.lib.cptools.serveFile(syslogfile,
+ disposition="attachment", name="syslog.txt")
+ else:
+ self.cbox.log.error("'%s' could not be exposed" % syslogfile)
+
log_file = self.__get_log_destination_file()
if log_file is None:
return ""
else:
return cherrypy.lib.cptools.serveFile(log_file,
disposition="attachment", name="cryptobox_logfile.txt")
+
def get_status(self):
"""The current status includes the log configuration details.
diff --git a/plugins/logs/show_log.cs b/plugins/logs/show_log.cs
index 314b3f2..c9e88c1 100644
--- a/plugins/logs/show_log.cs
+++ b/plugins/logs/show_log.cs
@@ -71,7 +71,7 @@
-
+
diff --git a/src/cryptobox/web/sites.py b/src/cryptobox/web/sites.py
index 6eeca34..5b5ec60 100644
--- a/src/cryptobox/web/sites.py
+++ b/src/cryptobox/web/sites.py
@@ -434,21 +434,6 @@ class WebInterfaceSites:
time.sleep(1)
yield "