Пример #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")
Пример #2
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")
Пример #3
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)
Пример #4
0
 def print_edittag(self, datfile):
     str_title = self.file_decode(datfile)
     cache = Cache(datfile)
     datfile = cgi.escape(datfile)
     if not cache.exists():
         print404()
         return
     var = {
         'datfile': datfile,
         'tags': str(cache.tags),
         'sugtags': cache.sugtags,
         'usertags': UserTagList(),
     }
     self.header('%s: %s' % (self.message['edit_tag'], str_title),
                 deny_robot=True)
     self.stdout.write(self.template('edit_tag', var))
     self.footer()
Пример #5
0
 def print_title(self):
     message = self.message
     cachelist = CacheList()
     cachelist.sort(key=lambda x: x.valid_stamp, reverse=True)
     now = int(time())
     output_cachelist = []
     for cache in cachelist:
         if now <= cache.valid_stamp + config.top_recent_range:
             output_cachelist.append(cache)
     self.header(message['logo'] + ' - ' + message['description'])
     var = {
         'cachelist': output_cachelist,
         'target': 'changes',
         'taglist': UserTagList(),
     }
     self.stdout.write(self.template('top', var))
     self.print_new_element_form()
     self.footer()
Пример #6
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)
Пример #7
0
     newcookie = self.setcookie(cache, access)
 else:
     newcookie = ''
 mobileuri = '%s?thread=%s' % (self.mobile_cgi, str_path)
 if page:
     mobileuri += '&amp;page=%d' % page
 elif id:
     mobileuri += '&amp;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))
Пример #8
0
     newcookie = self.setcookie(cache, access)
 else:
     newcookie = ''
 mobileuri = '%s?thread=%s' % (self.mobile_cgi, str_path)
 if page:
     mobileuri += '&amp;page=%d' % page
 elif id:
     mobileuri += '&amp;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))