def GET(self, uid): page = Page() page.title = "教学视频" try: notes_html = open("%s/data/notes/%s/prod/1.txt" % (page.base_path, uid)).read() except: return 'None' return render.notes(page, notes_html)
def test_str_outputStringIsAsExpected(self): test_page = Page() test_page.title = 'D01' test_page.content = 'Bla Bla Blub' expected_output = os.linesep.join([ '---------------------------------------------------------------------------', 'D01', '---------------------------------------------------------------------------', 'Bla Bla Blub' ]) self.assertEqual(expected_output, str(test_page))
def parse(self, text, url): dom = self.parseDocument(text) page = Page() page.title = self.get_text_from_element('title') page.content = self.remove_a_tags(self.get_text_from_element('body')) page.url = url def read_link(link): return URLUtils.join_relurl_to_absurl(url, link['href']) page.out_links = [read_link(link) for link in dom.select('a[href]')] page.out_links = ListUtil.to_list_without_duplicated_entries(page.out_links) return page
def GET(self): page = Page(); page.title = "课程设置" page.curnav = 2 return render.lesson(page);
def GET(self): page = Page(); page.title = "关于千知 | 联系我们" page.curnav = 5 return render.about(page);
def GET(self): page = Page(); page.title = "名师介绍" page.curnav = 3 return render.teacher(page);
def GET(self): page = Page(); page.title = "信息学竞赛培训" page.curnav = 4 return render.noip(page);