OSDN Git Service

Enable to reload whitelist file by dbus.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Sat, 16 Sep 2006 15:43:57 +0000 (00:43 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Sat, 16 Sep 2006 15:43:57 +0000 (00:43 +0900)
src/FukuiNoNamari/BbsType/bbs_type_other.py
src/FukuiNoNamari/dbus_object.py

index 0725adc..34ecd64 100644 (file)
@@ -25,11 +25,15 @@ from bbs_type_exception import BbsTypeError
 _whitelist = []
 
 whitelist_path = os.path.expanduser("~/.fukui-no-namari/whitelist")
-try:
-    for line in file(whitelist_path):
-        _whitelist.append(line.rstrip())
-except IOError:
-    traceback.print_exc()
+
+def whitelist_load():
+    try:
+        for line in file(whitelist_path):
+            _whitelist.append(line.rstrip())
+    except IOError:
+        traceback.print_exc()
+
+whitelist_load()
 
 _board_reg_expr = re.compile("http://(?P<host>.+)/(?P<board>[^/]+)(?:/[^/]*){0,1}$")
 
index 0125327..f5eee92 100644 (file)
@@ -21,6 +21,7 @@ if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
     import dbus.glib
 
 import uri_opener
+from BbsType import bbs_type_other
 
 dbus_interface_name = "tk.tetteke.FukuiNoNamari"
 
@@ -32,3 +33,7 @@ class DBusFukuiNoNamariObject(dbus.service.Object):
     @dbus.service.method(dbus_interface_name)
     def open_uri(self, uri, update=False):
         uri_opener.open_uri(uri, update)
+
+    @dbus.service.method(dbus_interface_name)
+    def whitelist_reload(self):
+        bbs_type_other.whitelist_load()