def proc_cmds(self): parsed_url = urlparse.urlparse(self.request_handler.path) query = urlparse.parse_qs(parsed_url.query) # work out which commander to use, zero index int, full path name, or file name c_idx = query.get('c', [0])[0] if c_idx is not 0: try: c_idx = int(c_idx) except ValueError: paths = [i.fileName() for i in g.app.commanders()] if c_idx in paths: c_idx = paths.index(c_idx) else: paths = [os.path.basename(i) for i in paths] c_idx = paths.index(c_idx) ans = None for cmd in query['cmd']: ans = valuespace.eval_text(g.app.commanders()[c_idx], cmd) return ans # the last answer, if multiple commands run