]> git.meshlink.io Git - catta/blobdiff - avahi-python/avahi/ServiceTypeDatabase.py.in
add GTK properties
[catta] / avahi-python / avahi / ServiceTypeDatabase.py.in
index 66b29c86cddb3875e0b3223c7deb4fd5ccc04653..95c03a47cff097181000947feb966b3972599db6 100644 (file)
@@ -19,7 +19,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 # USA.
 
-import gdbm
+import @DBM@
 import locale
 import re
 
@@ -29,7 +29,7 @@ class ServiceTypeDatabase:
 
     def __init__(self, filename = "@pkgdatadir@/service-types.db"):
 
-        self.db = gdbm.open(filename, "r")
+        self.db = @DBM@.open(filename, "r")
 
         l = locale.getlocale(locale.LC_MESSAGES)
 
@@ -69,12 +69,12 @@ class ServiceTypeDatabase:
     def items(self):
 
         items = []
-        key = self.db.firstkey()
-        while key is not None:
-            if re.search('_\w*\._\w*', key) and not re.search('_\w*\._\w*\[.*\]', key):
+        @FIRST_KEY@
+        @CHECK_KEY@
+            if re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+', key) and not re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+\[.*\]', key):
                 localized_service_name = self[key]
                 items.append((key, localized_service_name))
-            key = self.db.nextkey(key)
+            @NEXT_KEY@
         return items
 
     def has_key(self, key):
@@ -100,6 +100,7 @@ class ServiceTypeDatabase:
 if __name__ == "__main__":
     
     b = ServiceTypeDatabase()
+    print b.items()
 
     print b["_http._tcp"]
     print b["_ftp._tcp"]