#!/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
from rssurl import Rssurl from os import path from httphandler import Request, Response import cgitb; cgitb.enable() errors = {} value_dic = {'errors': errors, 'title': '', 'url': '', 'item_id': ''} req = Request() f = req.form p = path.join(path.dirname(__file__), 'editform.html') if not f.getvalue('posted'): id = f.getvalue('id') rss = Rssurl(id=int(id)) value_dic.update({'title': rss.title, 'url': rss.url, 'item_id': id}) else: id = f.getvalue('id') 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 not errors: rss = Rssurl(id=int(f.getvalue('id'))) rss.title = f.getvalue('title') rss.url = f.getvalue('url') rss.update()
#!/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
#!/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
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 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
from os import path from httphandler import Request, Response import cgitb cgitb.enable() errors = {} value_dic = {'errors': errors, 'title': '', 'url': '', 'item_id': ''} req = Request() f = req.form p = path.join(path.dirname(__file__), 'editform.html') if not f.getvalue('posted'): id = f.getvalue('id') rss = Rssurl(id=int(id)) value_dic.update({'title': rss.title, 'url': rss.url, 'item_id': id}) else: id = f.getvalue('id') title = unicode(f.getvalue('title', ''), "utf-8", "ignore") url = f.getvalue('url', '') value_dic.update({'title': title, 'url': url, 'item_id': id}) if not title: errors['title'] = u"たいとるをにゅうりょくしてね!" if not url.startswith('http://'): errors["url"] = u"ただしいゆーあーるえるをにゅうりょくしてね!" if not errors: rss = Rssurl(id=int(f.getvalue('id'))) rss.title = unicode(f.getvalue('title', ''), "utf-8", "ignore") rss.url = f.getvalue('url', '') rss.update()
from simpletemplate import SimpleTemplate from rssurl import Rssurl from os import path from httphandler import Request, Response import cgitb cgitb.enable() value_dic = {'errors': "", 'title': '', 'url': '', 'item_id': ''} req = Request() f = req.form p = path.join(path.dirname(__file__), 'deleteform.html') id = f.getvalue("id") rss = Rssurl(id=int(id)) if not f.getvalue('posted'): id = f.getvalue('id') rss = Rssurl(id=int(id)) value_dic.update({'title': rss.title, 'url': rss.url, 'item_id': id}) else: id = f.getvalue('id') rss = Rssurl(id=int(f.getvalue('id'))) rss.delete() 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)
#! /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
from rssurl import Rssurl from os import path from httphandler import Request, Response import cgitb; cgitb.enable() errors = {} value_dic = {'errors': errors, 'title':'', 'url': '', 'item_id':''} req = Request() f = req.form p = path.join(path.dirname(__file__), 'editform.html') if not f.getvalue('posted'): id = f.getvalue('id') rss = Rssurl(id=int(id)) value_dic.update({'title': rss.title, 'url': rss.url, 'item_id': id}) else: id = f.getvalue('id') title = f.getvalue('title', '') url = f.getvalue('url', '') value_dic.update({'title': title, 'url': url, 'item_id': id}) if not title: errors['title'] = 'タイトルを入力してください。' if not url: errors['title'] = '正しいURLを入力してください。' if not errors: rss = Rssurl(id=int(f.getvalue('id'))) rss.title = title rss.url = url rss.upate()
from os import path from httphandler import Request, Response import cgitb cgitb.enable() errors = {} value_dic = {'errors': errors, 'title': '', 'url': '', 'item_id': ''} req = Request() f = req.form p = path.join(path.dirname(__file__), 'editform.html') if not f.getvalue('posted'): id = f.getvalue('id') rss = Rssurl(id=int(id)) value_dic.update({'title': rss.title, 'url': rss.url, 'item_id': id}) else: id = f.getvalue('id') 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 not errors: rss = Rssurl(id=int(f.getvalue('id'))) rss.title = f.getvalue('title') rss.url = f.getvalue('url') rss.update()
#!/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
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 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)
from os import path from httphandler import Request, Response import cgitb cgitb.enable() errors = {} value_dic = {"errors": errors, "title": "", "url": "", "item_id": ""} req = Request() f = req.form p = path.join(path.dirname(__file__), "editform.html") if not f.getvalue("posted"): id = f.getvalue("id") rss = Rssurl(id=int(id)) value_dic.update({"title": rss.title, "url": rss.url, "item_id": id}) else: id = f.getvalue("id") 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 not errors: rss = Rssurl(id=int(f.getvalue("id"))) rss.title = unicode(f.getvalue("title", ""), "utf-8", "ignore") rss.url = f.getvalue("url", "")
from os import path from httphandler import Request, Response import cgitb; cgitb.enable() errors = {} value_dic = {"errors":errors, "title":"", "url":"", "item_id":""} req = Request() f = req.form p = path.join(path.dirname(__file__),"editform.html") if not f.getvalue("posted"): id = f.getvalue("id") rss = Rssurl(id = int(id)) value_dic.update({"title":rss.title ,"url":rss.url ,"item_id":id}) else: id = f.getvalue("id") 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://") or url.startswith("https://")): errors["url"] = u"正しいURLを入力してください" if not errors: rss = Rssurl(id = int(f.getvalue("id"))) rss.title = f.getvalue("title") rss.url = f.getvalue("url") rss.update()