Example #1
0
 def save_tag(self, datfile, tags):
     cache = Cache(datfile)
     print cache
     if not cache.exists():
         print404()
         return
     taglist = tags.split()
     cache.tags.update(taglist)
     cache.tags.sync()
     user_tag_list = UserTagList()
     user_tag_list.add(taglist)
     user_tag_list.sync()
     for type in config.types:
         title = self.str_encode(self.file_decode(datfile))
         if datfile.startswith(type + "_"):
             next = self.appli[type] + self.sep + title
             break
     else:
         next = self.root
     self.print302(next)
Example #2
0
 def save_tag(self, datfile, tags):
     cache = Cache(datfile)
     print cache
     if not cache.exists():
         print404()
         return
     taglist = tags.split()
     cache.tags.update(taglist)
     cache.tags.sync()
     user_tag_list = UserTagList()
     user_tag_list.add(taglist)
     user_tag_list.sync()
     for type in config.types:
         title = self.str_encode(self.file_decode(datfile))
         if datfile.startswith(type + "_"):
             next = self.appli[type] + self.sep + title
             break
     else:
         next = self.root
     self.print302(next)
Example #3
0
 else:
     newcookie = ''
 mobileuri = '%s?thread=%s' % (self.mobile_cgi, str_path)
 if page:
     mobileuri += '&page=%d' % page
 elif id:
     mobileuri += '&id=%s' % id
 rss = self.gateway_cgi + '/rss'
 self.header(path, rss=rss, cookie=newcookie, mobile=mobileuri)
 form = cgi.FieldStorage(environ=self.environ, fp=self.stdin)
 tags = form.getfirst('tag', '').strip().split()
 if self.isadmin and tags:
     cache.tags.add(tags)
     cache.tags.sync()
     user_tag_list = UserTagList()
     user_tag_list.add(tags)
     user_tag_list.sync()
 self.print_tags(cache)
 lastrec = None
 ids = cache.keys()
 if len(cache) and (not page) and (not id) and (not ids):
     lastrec = cache[ids[-1]]
 var = {
     'path': path,
     'str_path': str_path,
     'cache': cache,
     'lastrec': lastrec,
     'res_anchor': self.res_anchor,
 }
 self.stdout.write(self.template('thread_top', var))
 self.print_page_navi(page, cache, path, str_path, id)
Example #4
0
 else:
     newcookie = ''
 mobileuri = '%s?thread=%s' % (self.mobile_cgi, str_path)
 if page:
     mobileuri += '&page=%d' % page
 elif id:
     mobileuri += '&id=%s' % id
 rss = self.gateway_cgi + '/rss'
 self.header(path, rss=rss, cookie=newcookie, mobile=mobileuri)
 form = cgi.FieldStorage(environ=self.environ, fp=self.stdin)
 tags = form.getfirst('tag', '').strip().split()
 if self.isadmin and tags:
     cache.tags.add(tags)
     cache.tags.sync()
     user_tag_list = UserTagList()
     user_tag_list.add(tags)
     user_tag_list.sync()
 self.print_tags(cache)
 lastrec = None
 ids = cache.keys()
 if len(cache) and (not page) and (not id) and (not ids):
     lastrec = cache[ids[-1]]
 var = {
     'path': path,
     'str_path': str_path,
     'cache': cache,
     'lastrec': lastrec,
     'res_anchor': self.res_anchor,
 }
 self.stdout.write(self.template('thread_top', var))
 self.print_page_navi(page, cache, path, str_path, id)