def index(self, id=None): c.views = self.VIEWS c.view = id if id in c.views else sorted(c.views)[0] c.title = c.views[c.view] c.rt_globals = self.rt_globals if c.view == "icons": c.icons = sorted(os.path.splitext(name)[0] for name in os.listdir(os.path.join(os.path.dirname(__file__), "../public/img/svg/icons")) if name.endswith(".svg") ) elif c.view == "rtorrent": c.proxy = rtorrent.Proxy() if request.params.get("methods"): c.methods = defaultdict(list) for method in c.proxy.rpc.system.listMethods(): c.methods[method[0].upper()].append((method, ( c.proxy.rpc.system.methodSignature(method), c.proxy.rpc.system.methodHelp(method), ))) elif c.view == "json": c.json_api = dict((method, getattr(getattr(JsonController, method), '__doc__')) for method in dir(JsonController) if not method.startswith('_') and method != 'index' and callable(getattr(JsonController, method)) ) # Return a rendered template return render("pages/sandbox.mako")
def index(self, id=None): c.views = self.VIEWS c.view = id if id in c.views else sorted(c.views)[0] c.title = c.views[c.view] c.rt_globals = self.rt_globals if c.view == "icons": c.icons = sorted( os.path.splitext(name)[0] for name in os.listdir(os.path.join(os.path.dirname(__file__), "../public/img/svg/icons")) if name.endswith(".svg") ) elif c.view == "rtorrent": c.proxy = rtorrent.Proxy() if request.params.get("methods"): c.methods = defaultdict(list) for method in c.proxy.rpc.system.listMethods(): c.methods[method[0].upper()].append( (method, (c.proxy.rpc.system.methodSignature(method), c.proxy.rpc.system.methodHelp(method))) ) elif c.view == "json": c.json_api = dict( (method, getattr(getattr(JsonController, method), "__doc__")) for method in dir(JsonController) if not method.startswith("_") and method != "index" and callable(getattr(JsonController, method)) ) # Return a rendered template return render("pages/sandbox.mako")
def view(self, id): c.hash = id c.name = id c.torrents = list(rtorrent.View(self.proxy, "incomplete").items()) # Return a rendered template return render("pages/torrent.mako")
def list(self, id): c.view = self.views[id] # Get list of torrents if c.view.get("stock", True): # Built-in view c.torrents = list(rtorrent.View(self.proxy, id).items()) else: # Handle non-stock views c.torrents = getattr(self, "_get_" + id)() # Handle filter c.torrents_unfiltered = len(c.torrents) c.filter = self._normalized_filter() c.torrents = self._filter(c.torrents, c.filter) # Build view model self._model_fixup() # Return a rendered template return render("pages/view.mako")
def _render(self): return render("/pages/stats.mako")
def _render(self): return render("/pages/admin.mako")
def index(self): # Build model c.page = WikiPage.open("PyroScope") # Return a rendered template return render("/pages/index.mako")
def wiki(self, id): # Build model c.page = WikiPage.open(id) # Return a rendered template return render("pages/help.mako")