cgitb.enable() errors = {} value_dic = {'errors': errors, 'title': '', 'url': '', 'item_id': ''} req = Request() f = req.form p = path.join(path.dirname(__file__), 'addform.html') if f.getvalue('posted'): title = unicode(f.getvalue('title', ''), "utf-8", "ignore") url = f.getvalue('url', '') value_dic.update({'title': title, 'url': url}) if not title: errors['title'] = u"たいとるをにゅうりょくしてね!" if not url.startswith('http://'): errors["url"] = u"ただしいゆーあーるえるをにゅうりょくしてね!" if [x for x in Rssurl.select(url=url)]: errors["url"] = u"もう登録してあるやつやで" if not errors: Rssurl(title=title, url=url) p = path.join(path.dirname(__file__), "posted.html") value_dic["message"] = u"RSS取得URLをついかしたお!" t = SimpleTemplate(file_path=p) res = Response() body = t.render(value_dic) res.set_body(body) print res
#!/usr/bin/env python # coding: utf-8 from simpletemplate import SimpleTemplate from rssurl import Rssurl from os import path from httphandler import Request, Response import cgitb; cgitb.enable() value_dic = {'rsslist' : [x for x in Rssurl.select(order_by = 'id')]} res = Response() p = path.join(path.dirname(__file__), 'urllist.html') t = SimpleTemplate(file_path = p) body = t.render(value_dic) res.set_body(body) print res
#!/usr/bin/python # coding: utf-8 from simpletemplate import SimpleTemplate from rssurl import Rssurl from os import path from httphandler import Request, Response import cgitb cgitb.enable() value_dic = {'rsslist': [x for x in Rssurl.select(order_by='id')]} res = Response() p = path.join(path.dirname(__file__), 'urllist.html') t = SimpleTemplate(file_path=p) body = t.render(value_dic) res.set_body(body) print res
#!/usr/bin/env python # coding: utf-8 from simpletemplate import SimpleTemplate from rssurl import Rssurl from os import path from httphandler import Request, Response from rssparser import parse_rss import cgitb; cgitb.enable() rsslist=[] try: for rss in Rssurl.select(order_by='id'): rsslist.extend(parse_rss(rss.url)) except: pass res=Response() p=path.join(path.dirname(__file__), 'rsslist.html') t=SimpleTemplate(file_path=p) body=t.render({'rsslist':rsslist[:20]}) res.set_body(body) print res
#!/usr/bin/python # coding: utf-8 from simpletemplate import SimpleTemplate from rssurl import Rssurl from os import path from httphandler import Request, Response from rssparser import parse_rss import cgitb cgitb.enable() rsslist = [] try: # TODO: 実装 for rss in Rssurl.select(order_by='id'): rsslist.extend(parse_rss(rss.url)) except: pass res = Response() p = path.join(path.dirname(__file__), 'rsslist.html') t = SimpleTemplate(file_path=p) body = t.render({'rsslist': rsslist[:20]}) res.set_body(body) print res
cgitb.enable() errors = {} value_dic = {"errors": errors, "title": "", "url": "", "item_id": ""} req = Request() f = req.form if f.getvalue("posted"): title = unicode(f.getvalue("title", ""), "utf-8", "ignore") url = unicode(f.getvalue("url", ""), "utf-8", "ignore") value_dic.update({"title": title, "url": url, "item_id": id}) if not title: errors["title"] = u"タイトルを入力してください" if not url.startswith("http://"): errors["url"] = u"正しいURLを入力してください" if [x for x in Rssurl.select(url=url)]: errors["url"] = u"このURLは登録済みです" if not errors: Rssurl(title=title, url=url) p = path.join(path.dirname(__file__), "posted.html") value_dic["message"] = u"RSS取得URLを追加しました" res = Response() p = path.join(path.dirname(__file__), "addform.html") t = SimpleTemplate(file_path=p) body = t.render(value_dic) res.set_body(body) print res
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from simpletemplate import SimpleTemplate from rssurl import Rssurl from os import path from rssparser import parse_rss from httphandler import Request, Response import cgitb; cgitb.enable() rsslist = [] try: for rss in Rssurl.select(order_by="id"): rsslist.extend(parse_rss(rss.url)) except: pass res = Response() p = path.join(path.dirname(__file__), 'rsslist.html') t = SimpleTemplate(file_path=p) body = t.render({'rsslist': rsslist[:20]}) res.set_body(body) print(res)
#! /usr/bin/env python # coding: utf-8 from simpletemplate import SimpleTemplate from rssurl import Rssurl from os import path from httphandler import Request, Response import cgitb cgitb.enable() value_dic = {"rsslist": [x for x in Rssurl.select(order_by="id")]} res = Response() p = path.join(path.dirname(__file__), "urllist.html") t = SimpleTemplate(file_path=p) body = t.render(value_dic) res.set_body(body) print res
#!/home/minori/.pyenv/shims/python # coding: utf-8 from simpletemplate import SimpleTemplate from rssurl import Rssurl from os import path from httphandler import Request, Response import cgitb; cgitb.enable() value_dic = {"rsslist":[x for x in Rssurl.select(order_by = "id")]} res = Response() p = path.join(path.dirname(__file__), "urllist.html") t = SimpleTemplate(file_path = p) body = t.render(value_dic) res.set_body(body) print res
#!/home/minori/.pyenv/shims/python # coding: utf-8 from simpletemplate import SimpleTemplate from rssurl import Rssurl from os import path from httphandler import Request, Response from rssparser import parse_rss import cgitb cgitb.enable() rsslist = [] try: for rss in Rssurl.select(order_by="id"): rsslist.extend(parse_rss(rss.url)) except: pass res = Response() p = path.join(path.dirname(__file__), "rsslist.html") t = SimpleTemplate(file_path=p) body = t.render({"rsslist": rsslist[:20]}) res.set_body(body) print res