fixed bug in plugin_manager (missing name of submit button)
cleaned up the base plugin code
This commit is contained in:
parent
b85051a44d
commit
ef20189851
4 changed files with 20 additions and 26 deletions
|
@ -61,8 +61,8 @@
|
|||
var:html_escape(Lang.Plugins.plugin_manager.Button.Up) ?>"
|
||||
title="<?cs var:html_escape(Lang.Plugins.plugin_manager.Button.Up)
|
||||
?>" /></a><?cs /if ?>
|
||||
<input type="hidden" name="<?cs var:html_escape(name(x)) ?>_rank"
|
||||
value="<?cs var:html_escape(x.Rank) ?>" />
|
||||
<input type="hidden" name="<?cs var:html_escape(name(x))
|
||||
?>_rank" value="<?cs var:html_escape(x.Rank) ?>" />
|
||||
<input type="hidden" name="<?cs var:name(x) ?>_listed" value="1" /></td>
|
||||
</tr><?cs /if ?><?cs /each ?><?cs /loop ?>
|
||||
</table>
|
||||
|
@ -113,7 +113,8 @@
|
|||
var:html_escape(Lang.Plugins.plugin_manager.Button.Up) ?>"
|
||||
title="<?cs var:html_escape(Lang.Plugins.plugin_manager.Button.Up)
|
||||
?>" /></a><?cs /if ?>
|
||||
<input type="hidden" name="<?cs var:html_escape(name(x)) ?>_rank" value="<?cs var:html_escape(x.Rank) ?>" />
|
||||
<input type="hidden" name="<?cs var:html_escape(name(x))
|
||||
?>_rank" value="<?cs var:html_escape(x.Rank) ?>" />
|
||||
<input type="hidden" name="<?cs var:name(x) ?>_listed" value="1" /></td>
|
||||
</tr><?cs /if ?><?cs /each ?><?cs /loop ?>
|
||||
</table>
|
||||
|
@ -121,6 +122,7 @@
|
|||
</fieldset>
|
||||
|
||||
<p>
|
||||
<input type="hidden" name="store" value="1" />
|
||||
<button type="submit"><?cs var:html_escape(Lang.Plugins.plugin_manager.Button.SaveSettings) ?></button>
|
||||
</p>
|
||||
|
||||
|
|
|
@ -58,8 +58,9 @@ class plugin_manager(cryptobox.plugins.base.CryptoBoxPlugin):
|
|||
str(key[:-7]))
|
||||
try:
|
||||
self.cbox.prefs.plugin_conf.write()
|
||||
except IOError:
|
||||
self.cbox.log.warn("failed to write plugin configuration")
|
||||
self.cbox.log.info("Successfully stored plugin configuration")
|
||||
except IOError, err_msg:
|
||||
self.cbox.log.warn("Failed to write plugin configuration: %s" % err_msg)
|
||||
return "plugin_list"
|
||||
|
||||
|
||||
|
@ -141,5 +142,4 @@ class plugin_manager(cryptobox.plugins.base.CryptoBoxPlugin):
|
|||
setting["requestAuth"] = True
|
||||
else:
|
||||
setting["requestAuth"] = False
|
||||
self.cbox.prefs.plugin_conf[name] = setting
|
||||
|
||||
|
|
|
@ -673,7 +673,8 @@ class CryptoBoxContainer:
|
|||
time.sleep(3)
|
||||
## if the thread exited very fast, then it failed
|
||||
if not bg_task.isAlive():
|
||||
raise CBCreateError("Failed to initialize device: %s" % self.device)
|
||||
raise CBCreateError("formatting of device (%s) failed out " % self.device \
|
||||
+ "of unknown reasons")
|
||||
|
||||
|
||||
def __create_luks(self, password, fs_type="ext3"):
|
||||
|
@ -769,7 +770,8 @@ class CryptoBoxContainer:
|
|||
time.sleep(3)
|
||||
## if the thread exited very fast, then it failed
|
||||
if not bg_task.isAlive():
|
||||
raise CBCreateError("Failed to initilize device: %s" % self.device)
|
||||
raise CBCreateError("formatting of device (%s) failed out " % self.device \
|
||||
+ "of unknown reasons")
|
||||
|
||||
|
||||
def __clean_mount_dirs(self):
|
||||
|
|
|
@ -197,14 +197,9 @@ class CryptoBoxPlugin:
|
|||
first step: check plugin configuration
|
||||
second step: check default value of plugin
|
||||
"""
|
||||
try:
|
||||
if self.prefs["requestAuth"] is None:
|
||||
return self.request_auth
|
||||
if self.prefs["requestAuth"]:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except KeyError:
|
||||
if ("requestAuth" in self.prefs) and (not self.prefs["requestAuth"] is None):
|
||||
return bool(self.prefs["requestAuth"])
|
||||
else:
|
||||
return self.request_auth
|
||||
|
||||
|
||||
|
@ -213,13 +208,10 @@ class CryptoBoxPlugin:
|
|||
first step: check plugin configuration
|
||||
second step: check default value of plugin
|
||||
"""
|
||||
fallback = bool(self.plugin_visibility)
|
||||
try:
|
||||
if self.prefs["visibility"] is None:
|
||||
return fallback
|
||||
if ("visibility" in self.prefs) and (not self.prefs["visibility"] is None):
|
||||
return bool(self.prefs["visibility"])
|
||||
except KeyError:
|
||||
return fallback
|
||||
else:
|
||||
return bool(self.plugin_visibility)
|
||||
|
||||
|
||||
def get_rank(self):
|
||||
|
@ -227,11 +219,9 @@ class CryptoBoxPlugin:
|
|||
first step: check plugin configuration
|
||||
second step: check default value of plugin
|
||||
"""
|
||||
try:
|
||||
if self.prefs["rank"] is None:
|
||||
return int(self.rank)
|
||||
if ("rank" in self.prefs) and (not self.prefs["rank"] is None):
|
||||
return int(self.prefs["rank"])
|
||||
except (KeyError, TypeError):
|
||||
else:
|
||||
return int(self.rank)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue