Exemplo n.º 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
Exemplo n.º 2
0
 def get_resource(self, name, error = None):
     if name.startswith("/"):
         return get(self.conn, name, error or "Failed to get resource")
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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"