]> git.meshlink.io Git - catta/commitdiff
add new method items() to ServiceTypeDatabase
authorLennart Poettering <lennart@poettering.net>
Thu, 2 Mar 2006 18:22:46 +0000 (18:22 +0000)
committerLennart Poettering <lennart@poettering.net>
Thu, 2 Mar 2006 18:22:46 +0000 (18:22 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1172 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-python/avahi/ServiceTypeDatabase.py.in

index 9caeebd91cd74ca9cdd17743a6c306baa862c8a0..66b29c86cddb3875e0b3223c7deb4fd5ccc04653 100644 (file)
@@ -21,6 +21,7 @@
 
 import gdbm
 import locale
+import re
 
 locale.setlocale(locale.LC_ALL, '')
 
@@ -65,6 +66,17 @@ class ServiceTypeDatabase:
 
         raise KeyError()
 
+    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):
+                localized_service_name = self[key]
+                items.append((key, localized_service_name))
+            key = self.db.nextkey(key)
+        return items
+
     def has_key(self, key):
 
         for suffix in self.suffixes: