OSDN Git Service

Use bbs type widely.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Fri, 8 Sep 2006 00:01:27 +0000 (09:01 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Fri, 8 Sep 2006 00:01:27 +0000 (09:01 +0900)
src/FukuiNoNamari/BbsType/bbs_type_2ch.py
src/FukuiNoNamari/board_data.py
src/FukuiNoNamari/board_window.py
src/FukuiNoNamari/cachefile.py
src/FukuiNoNamari/datfile.py
src/FukuiNoNamari/idxfile.py
src/FukuiNoNamari/misc.py
src/FukuiNoNamari/submit_window.py
src/FukuiNoNamari/thread_window.py

index b4acb51..65533cf 100644 (file)
@@ -66,7 +66,10 @@ class Type2ch:
     def clone_with_thread(self, thread):
         if not thread:
             raise ValueError, "parameter must not be empty"
-        return Type2ch(self.host, self.board, thread)
+        another = Type2ch(self.host, self.board, thread)
+        another.bbs_type = self.bbs_type
+        another.uri = another.get_thread_uri()
+        return another
 
     def get_uri_base(self):
         return "http://" + self.host + "/" + self.board + "/"
@@ -84,3 +87,8 @@ class Type2ch:
             raise BbsTypeError, "not specified thread"
         return "http://" + self.host + "/test/read.cgi/" + \
                   self.board + "/" + self.thread + "/"
+
+    def get_board_dir_path(self):
+        """Returns board dir path from logs dir downward, not full path"""
+
+        return self.bbs_type + "/" + self.board
index c381921..a783d47 100644 (file)
@@ -88,42 +88,39 @@ class BoardData:
         datalist = {}
 
         def on_load_record(id, metadata_dic):
-            idxfile_path = misc.get_thread_idx_path(
-                self.bbs_type.bbs_type, self.bbs_type.board, id)
+            bbs_type_for_thread = self.bbs_type.clone_with_thread(id)
+            idxfile_path = misc.get_thread_idx_path(bbs_type_for_thread)
             if os.path.exists(idxfile_path):
                 self._add_idx(datalist, id, metadata_dic)
 
         print "load_cache"
-        cachefile.load_cache(
-            self.bbs_type.bbs_type, self.bbs_type.board, on_load_record)
+        cachefile.load_cache(self.bbs_type, on_load_record)
         print "load_idx"
         self._load_modified_idxfiles(datalist)
         print "save_cache"
-        cachefile.save_cache(
-            self.bbs_type.bbs_type, self.bbs_type.board, datalist)
+        cachefile.save_cache(self.bbs_type, datalist)
 
         return datalist
 
     def _load_modified_idxfiles(self, datalist):
-        basedir = misc.get_thread_idx_dir_path(
-            self.bbs_type.bbs_type, self.bbs_type.board)
+        basedir = misc.get_thread_idx_dir_path(self.bbs_type)
         if os.path.isdir(basedir):
             for idxfile_path in glob.glob(os.path.join(basedir, "*.idx")):
                 thread_id, ext = os.path.splitext(
                     os.path.basename(idxfile_path))
                 idxlastModified = os.path.getmtime(idxfile_path)
+                bbs_type_for_thread = self.bbs_type.clone_with_thread(
+                    thread_id)
                 if thread_id not in datalist:
                     print "new"
-                    dic = idxfile.load_idx(
-                        self.bbs_type.bbs_type, self.bbs_type.board, thread_id)
+                    dic = idxfile.load_idx(bbs_type_for_thread)
                     #dic.pop("etag")
                     dic["idxlastModified"] = idxlastModified
                     self._add_idx(datalist, thread_id, dic)
                 elif idxlastModified > datalist[thread_id]["idxlastModified"]:
                     print "modified"
                     datalist[thread_id]["idxlastModified"] = idxlastModified
-                    dic = idxfile.load_idx(
-                        self.bbs_type.bbs_type, self.bbs_type.board, thread_id)
+                    dic = idxfile.load_idx(bbs_type_for_thread)
                     for name in idxfile.metadata_namelist:
                         datalist[thread_id][name] = dic[name]
 
@@ -146,8 +143,7 @@ class BoardData:
         except ValueError:
             lastmod = 0
 
-        subjecttxt_path = misc.get_board_subjecttxt_path(
-            self.bbs_type.bbs_type, self.bbs_type.board)
+        subjecttxt_path = misc.get_board_subjecttxt_path(self.bbs_type)
         try:
             for num, line_encoded \
                     in itertools.izip(itertools.count(1),
@@ -193,8 +189,7 @@ class BoardData:
                 except ValueError:
                     lastmod = 0
 
-            subjecttxt_path = misc.get_board_subjecttxt_path(
-                self.bbs_type.bbs_type, self.bbs_type.board)
+            subjecttxt_path = misc.get_board_subjecttxt_path(self.bbs_type)
             basedir = os.path.dirname(subjecttxt_path)
             if not os.path.isdir(basedir):
                 os.makedirs(basedir)
@@ -229,8 +224,7 @@ class BoardData:
 
     def load_board_idx(self):
         lastmod = ""
-        boardidxfile = misc.get_board_idx_path(
-            self.bbs_type.bbs_type, self.bbs_type.board)
+        boardidxfile = misc.get_board_idx_path(self.bbs_type)
         try:
             for line in file(boardidxfile):
                 if line.startswith("lastModified="):
@@ -244,8 +238,7 @@ class BoardData:
         if not lastmod:
             return
 
-        boardidx_path = misc.get_board_idx_path(
-            self.bbs_type.bbs_type, self.bbs_type.board)
+        boardidx_path = misc.get_board_idx_path(self.bbs_type)
         basedir = os.path.dirname(boardidx_path)
         if not os.path.isdir(basedir):
             os.makedirs(basedir)
index d7429ee..f8154e5 100644 (file)
@@ -350,8 +350,7 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
             self.merge_remote_subjecttxt(datalist)
             gobject.idle_add(self.update_datastore, datalist)
 
-        sbj_path = misc.get_board_subjecttxt_path(
-            self.bbs_type.bbs_type, self.bbs_type.board)
+        sbj_path = misc.get_board_subjecttxt_path(self.bbs_type)
         sbj_exists = os.path.exists(sbj_path)
 
         if update or not sbj_exists:
@@ -363,8 +362,7 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
 
     def save(self):
         try:
-            states_path = misc.get_board_states_path(
-                self.bbs_type.bbs_type, self.bbs_type.board)
+            states_path = misc.get_board_states_path(self.bbs_type)
             dirname = os.path.dirname(states_path)
 
             # save only if board dir exists.
@@ -431,8 +429,7 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
             except:
                 traceback.print_exc()
 
-            states_path = misc.get_board_states_path(
-                self.bbs_type.bbs_type, self.bbs_type.board)
+            states_path = misc.get_board_states_path(self.bbs_type)
             if os.path.exists(states_path):
                 sort_column_name = "num"
                 sort_reverse = False
index 901994a..53184d1 100644 (file)
@@ -21,7 +21,7 @@ import misc
 
 metadata_namelist = ["title", "lineCount", "lastModified", "idxlastModified"]
 
-def load_cache(bbs, board, func):
+def load_cache(bbs_type, func):
     """ Loads metadata from .cache file
 
     loads metadata and invokes handler per one thread
@@ -38,7 +38,7 @@ def load_cache(bbs, board, func):
     """
 
     # nothing to do if .cache file does not exist
-    cachefile_path = misc.get_board_cache_path(bbs, board)
+    cachefile_path = misc.get_board_cache_path(bbs_type)
     if not os.path.exists(cachefile_path):
         return
 
@@ -75,7 +75,7 @@ def load_cache(bbs, board, func):
     finally:
         f.close()
 
-def save_cache(bbs, board, dic):
+def save_cache(bbs_type, dic):
     """ Saves metadata list to .cache file
 
     bbs: bbs id
@@ -89,7 +89,7 @@ def save_cache(bbs, board, dic):
     if not dic:
         return
 
-    cachefile_path = misc.get_board_cache_path(bbs, board)
+    cachefile_path = misc.get_board_cache_path(bbs_type)
 
     # create a directroy where .cache file is if not exists
     basedir = os.path.dirname(cachefile_path)
index 5a4221e..c672196 100644 (file)
@@ -26,15 +26,15 @@ REG_EXPR_TITLE = re.compile(".*<>.*<>.*<>.*<>(.*)")
 REG_EXPR_ELEM = re.compile( \
     "(?P<name>.*)<>(?P<mail>.*)<>(?P<date>.*)<>(?P<msg>.*)<>")
 
-def get_dat_file_size(bbs, board, thread):
+def get_dat_file_size(bbs_type):
     """Returns size of dat file"""
-    dat_path = misc.get_thread_dat_path(bbs, board, thread)
+    dat_path = misc.get_thread_dat_path(bbs_type)
     if not os.path.exists(dat_path):
         return 0
 
     return os.path.getsize(dat_path)
 
-def get_dat_line_count(bbs, board, thread):
+def get_dat_line_count(bbs_type):
     """Returns the number of line of a dat file specified by bbs, board
     and thread
 
@@ -44,7 +44,7 @@ def get_dat_line_count(bbs, board, thread):
 
     thread: thread id
     """
-    dat_path = misc.get_thread_dat_path(bbs, board, thread)
+    dat_path = misc.get_thread_dat_path(bbs_type)
     if not os.path.exists(dat_path):
         return 0
 
@@ -59,7 +59,7 @@ def do_get_title_from_dat(line):
             return m.group(1)
     return ""
     
-def get_title_from_dat(bbs, board, thread):
+def get_title_from_dat(bbs_type):
     """Returns thread title in dat file
 
     bbs: bbs id
@@ -70,7 +70,7 @@ def get_title_from_dat(bbs, board, thread):
 
     If failed, return None
     """
-    dat_path = misc.get_thread_dat_path(bbs, board, thread)
+    dat_path = misc.get_thread_dat_path(bbs_type)
     if not os.path.exists(dat_path):
         return None
 
@@ -99,7 +99,7 @@ def split_line_to_elems(line, func):
         msg = m.group("msg")
         func(name, mail, date, msg)
 
-def load_dat(bbs, board, thread, func):
+def load_dat(bbs_type, func):
     """Loads entire dat and invokes func per one res
 
     bbs: bbs id
@@ -113,7 +113,7 @@ def load_dat(bbs, board, thread, func):
     def some_func(line):
     where line is raw body of the res
     """
-    dat_path = misc.get_thread_dat_path(bbs, board, thread)
+    dat_path = misc.get_thread_dat_path(bbs_type)
     if not os.path.exists(dat_path):
         return
 
@@ -122,7 +122,7 @@ def load_dat(bbs, board, thread, func):
         func(line)
     f.close()
 
-def load_dat_partly(bbs, board, thread, func, resnum):
+def load_dat_partly(bbs_type, func, resnum):
     """Loads dat partly
     similar to load_dat, but load_dat_partly does not load entire dat.
 
@@ -136,7 +136,7 @@ def load_dat_partly(bbs, board, thread, func, resnum):
 
     resnum: load downward resnum
     """
-    dat_path = misc.get_thread_dat_path(bbs, board, thread)
+    dat_path = misc.get_thread_dat_path(bbs_type)
     if not os.path.exists(dat_path):
         return
 
index 18a2361..b559a03 100644 (file)
 import os
 import os.path
 from fileinput import FileInput
-from misc import get_thread_idx_path
+import misc
 
 metadata_namelist = ["title", "lineCount", "lastModified", "etag"]
 
-def load_idx(bbs, board, thread):
+def load_idx(bbs_type):
     """Loads index file of thread
 
     bbs: bbs id
@@ -34,7 +34,7 @@ def load_idx(bbs, board, thread):
     return dictionary which key is in metadata_namelist if idx file exist,
     otherwise return empty dic
     """
-    idxfile_path = get_thread_idx_path(bbs, board, thread)
+    idxfile_path = misc.get_thread_idx_path(bbs_type)
     if not os.path.exists(idxfile_path):
         return {"title":None,"lineCount":0,"lastModified":None,"etag":None}
 
@@ -64,7 +64,7 @@ def load_idx(bbs, board, thread):
                 datadic[name] = ""
     return datadic
 
-def save_idx(bbs, board, thread, datadic):
+def save_idx(bbs_type, datadic):
     """Saves thread metadatas to a index file
 
     bbs: bbs id
@@ -79,7 +79,7 @@ def save_idx(bbs, board, thread, datadic):
     """
 
     # create a directory where idx file should belong if does not exist
-    idxfile_path = get_thread_idx_path(bbs, board, thread)
+    idxfile_path = misc.get_thread_idx_path(bbs_type)
     basedir = os.path.dirname(idxfile_path)
     if not os.path.isdir(basedir):
         os.makedirs(basedir)
index 0ece770..d2ca0d5 100644 (file)
@@ -21,159 +21,86 @@ import time
 import threading
 
 import config
+from BbsType import bbs_type_exception
 
 REG_EXPR_HTTPDATE = re.compile("((?:Mon)|(?:Tue)|(?:Wed)|(?:Thu)|(?:Fri)|(?:Sat)|(?:Sun)), (\d{2}) ((?:Jan)|(?:Feb)|(?:Mar)|(?:Apr)|(?:May)|(?:Jun)|(?:Jul)|(?:Aug)|(?:Sep)|(?:Oct)|(?:Nov)|(?:Dec)) (\d{4}) (\d{2}):(\d{2}):(\d{2}) GMT")
 WDAY_DICT = {"Mon":0, "Tue":1, "Wed":2, "Thu":3, "Fri":4, "Sat":5, "Sun":6}
 MON_DICT = {"Jan":1, "Feb":2, "Mar":3, "Apr":4, "May":5, "Jun":6, "Jul":7,
             "Aug":8, "Sep":9, "Oct":10, "Nov":11, "Dec":12}
 
+def _check_thread(bbs_type):
+    """if bbs_type is not thread, raise BbsTypeError"""
+
+    if not bbs_type.is_thread():
+        raise bbs_type_exception.BbsTypeError, \
+              "the bbs_type does not represent thread: " + bbs_type.uri
+
 def get_logs_dir_path():
     return os.path.join(config.get_config_dir_path(), "logs")
 
-def get_thread_dat_dir_path(bbs, board):
+def get_thread_dat_dir_path(bbs_type):
     """Returns dir path for saving thread dat file"""
 
-    # if parameter is empty, raise ValueError
-    if not bbs or not board:
-        raise ValueError, "parameter must not be empty"
+    return os.path.join(get_board_dir_path(bbs_type), "dat")
 
-    return os.path.join(get_board_dir_path(bbs, board), "dat")
-
-def get_thread_idx_dir_path(bbs, board):
+def get_thread_idx_dir_path(bbs_type):
     """Returns dir path for saving thread index file"""
 
-    # if parameter is empty, raise ValueError
-    if not bbs or not board:
-        raise ValueError, "parameter must not be empty"
-
-    return os.path.join(get_board_dir_path(bbs, board), "idx")
-
-def get_thread_states_dir_path(bbs, board):
-    if not bbs or not board:
-        raise ValueError, "parameter must not be empty"
-
-    return os.path.join(get_board_dir_path(bbs, board), "states")
-
-def get_thread_dat_path(bbs, board, thread):
-    """Returns thread dat file path
-
-    bbs: bbs id
-
-    board: board id
-
-    thread: thread id
-    """
-
-    # if parameter is empty, raise ValueError
-    if not bbs or not board or not thread:
-        raise ValueError, "parameter must not be empty"
-
-    return os.path.join(get_thread_dat_dir_path(bbs, board), thread + ".dat")
-
-def get_board_subjecttxt_url(bbs, board):
-    """Returns subject.txt file url
-
-    bbs: bbs id
-
-    board: board id
-    """
-
-    # if parameter is empty, raise ValueError
-    if not bbs or not board:
-        raise ValueError, "parameter must not be empty"
-
-    return get_board_base_url(bbs, board) + "subject.txt"
-
-def get_board_subjecttxt_path(bbs, board):
-    """Returns subject.txt file path
-
-    bbs: bbs id
-
-    board: board id
-    """
-
-    # if parameter is empty, raise ValueError
-    if not bbs or not board:
-        raise ValueError, "parameter must not be empty"
-
-    return os.path.join(get_logs_dir_path(), bbs, board, "subject.txt")
-
-def get_thread_states_path(bbs, board, thread):
-    # if parameter is empty, raise ValueError
-    if not bbs or not board or not thread:
-        raise ValueError, "parameter must not be empty"
-
-    return os.path.join(get_thread_states_dir_path(bbs, board),
-                        thread + ".states")
-
-def get_board_states_path(bbs, board):
-    # if parameter is empty, raise ValueError
-    if not bbs or not board:
-        raise ValueError, "parameter must not be empty"
-
-    return os.path.join(get_board_dir_path(bbs, board), "board.states")
-
-def get_board_idx_path(bbs, board):
-    """Returns board idx file path
-
-    bbs: bbs id
+    return os.path.join(get_board_dir_path(bbs_type), "idx")
 
-    board: board id
-    """
+def get_thread_states_dir_path(bbs_type):
+    """Returns dir path for saving thread states file"""
 
-    # if parameter is empty, raise ValueError
-    if not bbs or not board:
-        raise ValueError, "parameter must not be empty"
+    return os.path.join(get_board_dir_path(bbs_type), "states")
 
-    return os.path.join(get_logs_dir_path(), bbs, board, "subject.idx")
+def get_thread_dat_path(bbs_type):
+    """Returns thread dat file path"""
 
-def get_board_dir_path(bbs, board):
-    """Returns board dir path
+    _check_thread(bbs_type)
 
-    bbs: bbs ID
+    return os.path.join(get_thread_dat_dir_path(bbs_type),
+                        bbs_type.thread + ".dat")
 
-    board: board ID
-    """
+def get_board_subjecttxt_path(bbs_type):
+    """Returns subject.txt file path"""
 
-    # if parameter is empty, raise ValueError
-    if not bbs or not board:
-        raise ValueError, "parameter must not be empty"
+    return os.path.join(get_board_dir_path(bbs_type), "subject.txt")
 
-    return os.path.join(get_logs_dir_path(), bbs, board)
+def get_thread_states_path(bbs_type):
+    """Returns thread states file path"""
 
-def get_thread_idx_path(bbs, board, thread):
-    """Returns idx file path of thread
+    _check_thread(bbs_type)
 
-    bbs: bbs ID
+    return os.path.join(get_thread_states_dir_path(bbs_type),
+                        bbs_type.thread + ".states")
 
-    board: board ID
+def get_board_states_path(bbs_type):
+    """Returns board states file path"""
 
-    thread: thread ID
+    return os.path.join(get_board_dir_path(bbs_type), "board.states")
 
-    Note: if parameter is empty, raise ValueError
-    """
+def get_board_idx_path(bbs_type):
+    """Returns board idx file path"""
 
-    # if parameter is empty, raise ValueError
-    if not bbs or not board or not thread:
-        raise ValueError, "parameter must not be empty"
+    return os.path.join(get_board_dir_path(bbs_type), "subject.idx")
 
-    return os.path.join(get_thread_idx_dir_path(bbs, board), thread + ".idx")
+def get_board_dir_path(bbs_type):
+    """Returns board dir path"""
 
-def get_board_cache_path(bbs, board):
-    """ Returns .cache file path of board
+    return os.path.join(get_logs_dir_path(), bbs_type.get_board_dir_path())
 
-    bbs: bbs ID
+def get_thread_idx_path(bbs_type):
+    """Returns idx file path of thread"""
 
-    board: board ID
+    _check_thread(bbs_type)
 
-    Note: if parameter is empty, raise ValueError
-    """
+    return os.path.join(get_thread_idx_dir_path(bbs_type),
+                        bbs_type.thread + ".idx")
 
-    # if parameter is empty, raise ValueError
-    if not bbs or not board:
-        raise ValueError, "parameter must not be empty"
+def get_board_cache_path(bbs_type):
+    """Returns .cache file path of board"""
 
-    return os.path.join(get_thread_idx_dir_path(bbs, board), ".cache")
+    return os.path.join(get_thread_idx_dir_path(bbs_type), ".cache")
 
 def httpdate_to_secs(httpdate):
     """Returns the seconds since the epoch"""
index c2e435c..e46a4c5 100644 (file)
@@ -122,8 +122,7 @@ class WinWrap:
 
         self.widget_tree.signal_autoconnect(sigdic)
 
-        title = datfile.get_title_from_dat(
-            self.bbs_type.bbs_type, self.bbs_type.board, self.bbs_type.thread)
+        title = datfile.get_title_from_dat(self.bbs_type)
         if title:
             self.window.set_title(title)
 
index 6c1d3d3..b32f7bc 100644 (file)
@@ -251,7 +251,7 @@ class WinWrap(winwrapbase.WinWrapBase):
     def http_get_dat(self, on_get_res):
         datfile_url = self.bbs_type.get_dat_uri()
 
-        idx_dic = idxfile.load_idx(self.bbs, self.board, self.thread)
+        idx_dic = idxfile.load_idx(self.bbs_type)
         lastmod = idx_dic["lastModified"]
         etag = idx_dic["etag"]
 
@@ -297,15 +297,14 @@ class WinWrap(winwrapbase.WinWrapBase):
 
             if self.num > 0:
                 if not self.title:
-                    title = datfile.get_title_from_dat(
-                        self.bbs, self.board, self.thread)
+                    title = datfile.get_title_from_dat(self.bbs_type)
                     if title:
                         self.title = title
                         gobject.idle_add(self.window.set_title, title)
                 # save idx
                 idx_dic = {"title": self.title, "lineCount": self.num,
                        "lastModified": lastmod, "etag": etag}
-                idxfile.save_idx(self.bbs, self.board, self.thread, idx_dic)
+                idxfile.save_idx(self.bbs_type, idx_dic)
 
                 gobject.idle_add(session.thread_idx_updated,
                                  self.bbs_type.get_thread_uri(), idx_dic)
@@ -320,12 +319,10 @@ class WinWrap(winwrapbase.WinWrapBase):
                     self.textbuffer.create_mark("1", self.enditer, True)
                 gobject.idle_add(create_mark)
 
-            line_count = datfile.get_dat_line_count(
-                self.bbs, self.board, self.thread)
+            line_count = datfile.get_dat_line_count(self.bbs_type)
             if line_count > self.num:
                 datfile.load_dat_partly(
-                    self.bbs, self.board, self.thread,
-                    self.append_rawres_to_buffer, self.num+1)
+                    self.bbs_type, self.append_rawres_to_buffer, self.num+1)
 
                 def do_jump(num):
                     if self.jump_request_num:
@@ -343,8 +340,7 @@ class WinWrap(winwrapbase.WinWrapBase):
                 gobject.idle_add(do_jump, self.num)
 
         def get():
-            dat_path = misc.get_thread_dat_path(
-                self.bbs, self.board, self.thread)
+            dat_path = misc.get_thread_dat_path(self.bbs_type)
             dat_file = FileWrap(dat_path)
 
             def save_line_and_append_to_buffer(line):
@@ -387,8 +383,7 @@ class WinWrap(winwrapbase.WinWrapBase):
                 self.textbuffer.create_mark("1", self.enditer, True)
             gobject.idle_add(create_mark)
 
-            datfile.load_dat(self.bbs, self.board, self.thread,
-                             self.append_rawres_to_buffer)
+            datfile.load_dat(self.bbs_type, self.append_rawres_to_buffer)
         def jump():
 
             def do_jump(num):
@@ -513,8 +508,7 @@ class WinWrap(winwrapbase.WinWrapBase):
                     self.jump_request_num = int(resnum)
 
     def load(self, update=False):
-        dat_path = misc.get_thread_dat_path(
-            self.bbs_type.bbs_type, self.bbs_type.board, self.bbs_type.thread)
+        dat_path = misc.get_thread_dat_path(self.bbs_type)
         dat_exists = os.path.exists(dat_path)
         if update or not dat_exists:
             self.update()
@@ -523,12 +517,8 @@ class WinWrap(winwrapbase.WinWrapBase):
 
     def save(self):
         try:
-            states_path = misc.get_thread_states_path(
-                self.bbs_type.bbs_type, self.bbs_type.board,
-                self.bbs_type.thread)
-            dat_path = misc.get_thread_dat_path(
-                self.bbs_type.bbs_type, self.bbs_type.board,
-                self.bbs_type.thread)
+            states_path = misc.get_thread_states_path(self.bbs_type)
+            dat_path = misc.get_thread_dat_path(self.bbs_type)
 
             # save only if dat file exists.
             if os.path.exists(dat_path):
@@ -574,9 +564,7 @@ class WinWrap(winwrapbase.WinWrapBase):
             except:
                 traceback.print_exc()
 
-            states_path = misc.get_thread_states_path(
-                self.bbs_type.bbs_type, self.bbs_type.board,
-                self.bbs_type.thread)
+            states_path = misc.get_thread_states_path(self.bbs_type)
             if os.path.exists(states_path):
                 for line in file(states_path):
                     if line.startswith("window_height="):