OSDN Git Service

Fix bugs. not include "." in regular expression. import statement.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Sat, 9 Sep 2006 06:49:47 +0000 (15:49 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Sat, 9 Sep 2006 06:49:47 +0000 (15:49 +0900)
src/FukuiNoNamari/BbsType/bbs_type_other.py

index 75f7783..f821505 100644 (file)
@@ -20,6 +20,7 @@ import os.path
 import traceback
 
 from bbs_type_2ch import BaseType
+from bbs_type_exception import BbsTypeError
 
 _whitelist = []
 
@@ -48,14 +49,15 @@ class TypeOther(BaseType):
                     self.board = board
                     return
                 else:
-                    match = re.match(
-                        "http://%s/test/read.cgi/%s/(?P<thread>[^/]+)/" \
-                        % (host, board), uri)
-                    if match:
-                        self.host = host
-                        self.board = board
-                        self.thread = match.group("thread")
-                        return
+                    cgi_base = "http://%s/test/read.cgi/%s/" % (host, board)
+                    if uri.startswith(cgi_base):
+                        match = re.match(
+                            "(?P<thread>[^/]+)/", uri[len(cgi_base):])
+                        if match:
+                            self.host = host
+                            self.board = board
+                            self.thread = match.group("thread")
+                            return
             else:
                 print "%s in whitelist is not supported" % iru