def _getTaskList(self, id): try: tl = TaskList.get(int(id)) assert tl.project == c.project, ( "requested list %r doesn't match current project %r" % (tl, c.project)) assert tl.live, ( "Task %r not live" % tl) return tl except LookupError, AssertionError: if request.environ.get("HTTP_REFERER"): pass else: raise paste.httpexceptions.HTTPNotFound("Tasklist %d could not be found." % id)