Example #1
0
    def do_sync(self):
        self.check("sync")
        nodelist = NodeList()
        for n in nodelist[:]:
            nodelist.join(n)
        nodelist.sync()
        self.stderr.write("shingetsu.node.NodeList.join() finished\n")

        cachelist = CacheList()
        cachelist.rehash()
        self.stderr.write("shingetsu.cache.CacheList.rehash() finished\n")

        cachelist.clean_records()
        self.stderr.write("shingetsu.cache.CacheList.clean_records()" +
                          " finished\n")

        cachelist.remove_removed()
        self.stderr.write("shingetsu.cache.CacheList.remove_removed()" +
                          " finished\n")

        user_tag_list = UserTagList()
        user_tag_list.update_all()
        self.stderr.write("shingetsu.tag.UserTagList.update_all()" +
                          " finished\n")

        recentlist = RecentList()
        recentlist.getall()
        self.stderr.write("shingetsu.cache.RecentList.getall() finished\n")

        cachelist.getall(timelimit=self.timelimit)
        self.stderr.write("shingetsu.cache.CacheList.getall() finished\n")
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
     newcookie = self.setcookie(cache, access)
 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))