|
@@ -478,13 +478,18 @@ def enable_plugin(plugin):
|
|
|
|
|
|
disabled_file = os.path.join(plugin_dir, "DISABLED")
|
|
|
|
|
|
- os.remove(disabled_file)
|
|
|
-
|
|
|
- flash(_("Plugin is enabled. Please reload your app."), "success")
|
|
|
-
|
|
|
- flash(_("If you are using a host which doesn't support writting on the "
|
|
|
+ try:
|
|
|
+ if os.path.exists(disabled_file):
|
|
|
+ os.remove(disabled_file)
|
|
|
+ flash(_("Plugin is enabled. Please reload your app."), "success")
|
|
|
+ else:
|
|
|
+ flash(_("Plugin is already enabled. Please reload your app."), "warning")
|
|
|
+
|
|
|
+ except OSError:
|
|
|
+ flash(_("If you are using a host which doesn't support writting on the "
|
|
|
"disk, this won't work - than you need to delete the "
|
|
|
- "'DISABLED' file by yourself."), "info")
|
|
|
+ "'DISABLED' file by yourself."), "danger")
|
|
|
+
|
|
|
else:
|
|
|
flash(_("Couldn't enable Plugin."), "danger")
|
|
|
|
|
@@ -507,11 +512,12 @@ def disable_plugin(plugin):
|
|
|
|
|
|
disabled_file = os.path.join(plugin_dir, "DISABLED")
|
|
|
|
|
|
- open(disabled_file, "a").close()
|
|
|
-
|
|
|
- flash(_("Plugin is disabled. Please reload your app."), "success")
|
|
|
+ try:
|
|
|
+ open(disabled_file, "a").close()
|
|
|
+ flash(_("Plugin is disabled. Please reload your app."), "success")
|
|
|
|
|
|
- flash(_("If you are using a host which doesn't "
|
|
|
+ except OSError:
|
|
|
+ flash(_("If you are using a host which doesn't "
|
|
|
"support writting on the disk, this won't work - than you need to "
|
|
|
"create a 'DISABLED' file by yourself."), "info")
|
|
|
|