Example #1
0
 def list_directory(self, directory, error_msg = None, parse = True):
     response = get(self.conn, directory.path, error_msg)
     if not response or not parse:
         return response
     contents = self.parse_directory_response(response, directory)
     if directory.backlink:
         contents.insert(0, directory.backlink)
     return contents
Example #2
0
 def get_resource(self, name, error = None):
     if name.startswith("/"):
         return get(self.conn, name, error or "Failed to get resource")
Example #3
0
 def do_save(self, s):
     to_string = lambda s: "%s=%s" % (quote(s.identifier), quote(s.value))
     params = "&".join(map(to_string, self.settings))
     path = self.directory.path + "/set?" + params
     if get(self.conn, path, "Unable to save settings") is not None:
         self.dirty = False
Example #4
0
 def get_plugins(self, error_msg = None):
     response = get(self.conn, "/:/plugins/", error_msg)
     if not response:
         return None
     return self.parse_plugins_response(response)
Example #5
0
 def restart_plugin(self, plugin):
     print "Restarting plugin: %s" % plugin
     url = "/:/plugins/%s/restart" % plugin
     if get(self.conn, url, "Failed to restart plugin: ") is not None:
         print "Restart succeeded"