Beispiel #1
0
 def POST(self, pid=0):
     post = web.input(ptitle='',
                      ptstitle='',
                      pcategory=0,
                      pcontent='',
                      ptype=0,
                      ptags='',
                      pstatus=1,
                      pontop=0,
                      pcomment=1)
     tags = post['ptags']
     if tags:
         tags = tags.replace(" ", "")
         taglist = list(set(tags.split(",")))
         post['ptags'] = ','.join(taglist)
     if pid:
         model.Posts.modify(pid, post)
         model.Relations.remove(pid)
     else:
         pid = model.Posts.creat(post)
     if tags:
         otags = dict([[t.tag_name, t.tag_id]
                       for t in model.Tags.get_all()])
         for tag in taglist:
             if tag not in otags.keys() and len(tag) > 1:
                 tid = model.Tags.creat(tag)
                 model.Relations.creat(tid, pid)
             else:
                 model.Relations.creat(otags[tag], pid)
     return R.result('success', '/manage/postlist', '文章保存成功')
Beispiel #2
0
 def POST(self):
     nsetting = web.input(webtitle = 'Garfielt Blog',
                          websubtitle = 'Welcome to Mysite!',
                          webdes = 'The Garfielt Blog',
                          webkeys = 'Garfielt, Blog, Python, web.py',
                          webcdn = '',
                          timeadjust = 0,
                          listnum = 10)
     model.Kvdata.set('setting', nsetting)
     Setting.config = model.Kvdata.get("setting")
     return R.result('success', '/manage/setting', '设置修改成功')
Beispiel #3
0
 def POST(self):
     nsetting = web.input(webtitle='Garfielt Blog',
                          websubtitle='Welcome to Mysite!',
                          webdes='The Garfielt Blog',
                          webkeys='Garfielt, Blog, Python, web.py',
                          webcdn='',
                          timeadjust=0,
                          listnum=10)
     model.Kvdata.set('setting', nsetting)
     Setting.config = model.Kvdata.get("setting")
     return R.result('success', '/manage/setting', '设置修改成功')
Beispiel #4
0
 def POST(self, pid = 0):
     post = web.input(ptitle = '', ptstitle = '', pcategory = 0,
                      pcontent = '', ptype = 0, ptags = '', pstatus = 1,
                      pontop = 0, pcomment = 1)
     tags = post['ptags']
     if tags:
         tags = tags.replace(" ", "")
         taglist = list(set(tags.split(",")))
         post['ptags'] = ','.join(taglist)
     if pid:
         model.Posts.modify(pid, post)
         model.Relations.remove(pid)
     else:
         pid = model.Posts.creat(post)
     if tags:
         otags = dict([[t.tag_name, t.tag_id] for t in model.Tags.get_all()])
         for tag in taglist:
             if tag not in otags.keys() and len(tag)>1:
                 tid = model.Tags.creat(tag)
                 model.Relations.creat(tid, pid)
             else:
                 model.Relations.creat(otags[tag], pid)
     return R.result('success', '/manage/postlist', '文章保存成功')