예제 #1
0
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", "")
        rss.update()
        p = path.join(path.dirname(__file__), "posted.html")
        value_dic["message"] = u"RSS取得を編集しました"

t = SimpleTemplate(file_path=p)
res = Response()
body = t.render(value_dic)
res.set_body(body)
print res
예제 #2
0
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()
        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
예제 #3
0
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()
        p = path.join(path.dirname(__file__), 'posted.html')
        value_dic['message'] = 'RSS取得URLを編集しました'

t = SimpleTemplate(file_path=p)
res = Response()
body = t.render(value_dic)
res.set_body(body)
print(res)
예제 #4
0
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()
        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
예제 #5
0
    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()
        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