Author: damoxc

Revision: 5755

Log:
        have the plugin manager remove the scripts and directories from the 
server when a plugin is disabled

Diff:
Modified: trunk/deluge/ui/web/pluginmanager.py
===================================================================
--- trunk/deluge/ui/web/pluginmanager.py        2009-09-16 08:32:33 UTC (rev 
5754)
+++ trunk/deluge/ui/web/pluginmanager.py        2009-09-16 08:42:39 UTC (rev 
5755)
@@ -86,8 +86,25 @@
             log.info("Plugin has no web ui")
             return
         
+        info = gather_info(plugin)
+        
         server = component.get("DelugeWeb").top_level
+        js = component.get("Javascript")
+        for directory in info["script_directories"]:
+            js.removeDirectory(directory, name.lower())
         
+        for script in info["scripts"]:
+            script = "/js/%s/%s" % (name.lower(), os.path.basename(script))
+            if script not in server.scripts:
+                continue
+            server.scripts.remove(script)
+        
+        for script in info["debug_scripts"]:
+            script = "/js/%s/%s" % (name.lower(), os.path.basename(script))
+            if script not in server.debug_scripts:
+                continue
+            server.debug_scripts.remove(script)
+        
         super(PluginManager, self).disable_plugin(name)
     
     def enable_plugin(self, name):

Modified: trunk/deluge/ui/web/server.py
===================================================================
--- trunk/deluge/ui/web/server.py       2009-09-16 08:32:33 UTC (rev 5754)
+++ trunk/deluge/ui/web/server.py       2009-09-16 08:42:39 UTC (rev 5755)
@@ -255,6 +255,10 @@
         paths = self.__paths.get(path, [])
         paths.append(directory)
         self.__paths[path] = paths
+    
+    def removeDirectory(self, directory, path=""):
+        log.debug("Removing directory `%s`", directory)
+        self.__paths[path].remove(directory)
 
     def getChild(self, path, request):
         if hasattr(request, 'lookup_path'):



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to