def nav(page, current, state): if current.match(page, False): pre = '<li class="active">' else: pre = "<li>" p = state.application.getPage(page) return pre + '<a href="%s">%s</a></li>'%(model.UrlTo(page), p.title)
def test_url(self): state.page = self.t.getPage(os.path.join("one", "two")) assert str(model.UrlTo("two")) == "two" state.page = self.t.getPage("one") assert str(model.UrlTo("one")) == "one"
def test_url_internal(self): tutils.raises("internal page", str, model.UrlTo("internal"))
def test_url_nopage(self): tutils.raises("unknown page", str, model.UrlTo("Nonexistent"))
def test_url_anchor(self): s = str(model.UrlTo("TPageNoLink", anchor="foo")) assert s == "base/TPageNoLink#foo"
def test_url(self): assert str(model.UrlTo("TPageNoLink"))