summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-03-02 18:22:46 +0000
committerLennart Poettering <lennart@poettering.net>2006-03-02 18:22:46 +0000
commit575610565f6f60745f8562469acdaec081a26cd5 (patch)
treed02f377caba25461dc92700614e2dd1d6ede6cc3
parenta09232b36c2b00cce61f4777df223dac36176932 (diff)
add new method items() to ServiceTypeDatabase
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1172 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
-rw-r--r--avahi-python/avahi/ServiceTypeDatabase.py.in12
1 files changed, 12 insertions, 0 deletions
diff --git a/avahi-python/avahi/ServiceTypeDatabase.py.in b/avahi-python/avahi/ServiceTypeDatabase.py.in
index 9caeebd..66b29c8 100644
--- a/avahi-python/avahi/ServiceTypeDatabase.py.in
+++ b/avahi-python/avahi/ServiceTypeDatabase.py.in
@@ -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: