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