rev 3599 - in debbugs-illa: . bzlink

Pierre Habouzit madcoder at costa.debian.org
Tue Apr 18 22:24:36 UTC 2006


Author: madcoder
Date: 2006-04-18 22:24:30 +0000 (Tue, 18 Apr 2006)
New Revision: 3599

Added:
   debbugs-illa/bzlink.cfg
   debbugs-illa/bzlink/__init__.py
Modified:
   debbugs-illa/bzlink/
Log:
missing files




Property changes on: debbugs-illa/bzlink
___________________________________________________________________
Name: svn:ignore
   + *.pyc



Added: debbugs-illa/bzlink/__init__.py
===================================================================
--- debbugs-illa/bzlink/__init__.py	2006-04-18 22:23:44 UTC (rev 3598)
+++ debbugs-illa/bzlink/__init__.py	2006-04-18 22:24:30 UTC (rev 3599)
@@ -0,0 +1,75 @@
+# vim:set encoding=utf-8:
+###############################################################################
+# Copyright:
+#   © 2006 Pierre Habouzit <madcoder at debian.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+###############################################################################
+
+import os
+from ConfigParser import RawConfigParser
+
+class NoSuchSection(Exception):
+    def __init__(self, section):
+        self.args = (section)
+
+def unquote(s):
+    if len(s) > 2 and s[0] == s[-1] and s[0] in ('"', "'"):
+        return s[1:-1]
+    return s
+
+class _BzlinkConfig:
+    def __init__(self):
+        self._cfg = RawConfigParser()
+        self._cfg.read(['/etc/bzlink.cfg', './bzlink.cfg', os.path.expanduser('~/.bzlinkrc')])
+        self._section = None
+
+    def setSection(self, section):
+        if not self._cfg.has_section(section):
+            raise NoSuchSection(section)
+        self._section = section
+
+    def _get(self, option):
+        if self._section and self._cfg.has_option(self._section, option):
+            return unquote(self._cfg.get(self._section, option))
+        if self._cfg.has_option('general', option):
+            return unquote(self._cfg.get('general', option))
+        return None
+
+    def debug(self):    return self._get('debug')
+    def ldap(self):     return self._get('ldap')
+    def user(self):     return self._get('user')
+    def sender(self):   return self._get('from')
+
+    def bugzilla(self):
+        url = self._get('bugzilla')
+        if url is not None:
+            return url.rstrip('/')
+        else: return url
+
+BzlinkConfig = _BzlinkConfig()
+
+__all__ = ['BzlinkConfig', 'NoSuchSection']
+

Added: debbugs-illa/bzlink.cfg
===================================================================
--- debbugs-illa/bzlink.cfg	2006-04-18 22:23:44 UTC (rev 3598)
+++ debbugs-illa/bzlink.cfg	2006-04-18 22:24:30 UTC (rev 3599)
@@ -0,0 +1,10 @@
+[general]
+debug = false
+ldap  = 'ldap://bts2ldap.debian.net:10101'
+
+[kde]
+bugzilla = 'http://bugs.kde.org'
+user     = 'debian-qt-kde at lists.debian.org'
+from     = 'debian-qt-kde at lists.debian.org'
+
+




More information about the pkg-kde-commits mailing list