gtg team mailing list archive
-
gtg team
-
Mailing list archive
-
Message #03837
[Merge] lp:~qcxhome/gtg/bugzilla-plugin-bugfix into lp:gtg
Chenxiong Qi has proposed merging lp:~qcxhome/gtg/bugzilla-plugin-bugfix into lp:gtg.
Requested reviews:
Gtg developers (gtg)
For more details, see:
https://code.launchpad.net/~qcxhome/gtg/bugzilla-plugin-bugfix/+merge/172705
--
https://code.launchpad.net/~qcxhome/gtg/bugzilla-plugin-bugfix/+merge/172705
Your team Gtg developers is requested to review the proposed merge of lp:~qcxhome/gtg/bugzilla-plugin-bugfix into lp:gtg.
=== modified file 'GTG/plugins/bugzilla/bugzilla.py'
--- GTG/plugins/bugzilla/bugzilla.py 2013-03-31 15:18:43 +0000
+++ GTG/plugins/bugzilla/bugzilla.py 2013-07-03 00:35:31 +0000
@@ -21,11 +21,13 @@
from urlparse import urlparse
from services import BugzillaServiceFactory
+from services import BugzillaServiceNotExist
from notification import send_notification
__all__ = ('pluginBugzilla', )
bugIdPattern = re.compile('^\d+$')
+bugURLPattern = re.compile('^(https?)://(.+)/show_bug\.cgi\?id=(\d+)$')
class GetBugInformationTask(threading.Thread):
@@ -42,6 +44,12 @@
def run(self):
bug_url = self.task.get_title()
+
+ # We only handle bug URL. When task's title is not a bug URL, stop
+ # handling quietly.
+ if bugURLPattern.match(bug_url) is None:
+ return
+
scheme, hostname, queries = self.parseBugUrl(bug_url)
bug_id = queries.get('id', None)
@@ -51,6 +59,13 @@
try:
bugzillaService = BugzillaServiceFactory.create(scheme, hostname)
+ except BugzillaServiceNotExist:
+ # Stop quietly when bugzilla cannot be found. Currently, I don't
+ # assume that user enters a wrong hostname or just an unkown
+ # bugzilla service.
+ return
+
+ try:
bug = bugzillaService.getBug(bug_id)
except xmlrpclib.Fault, err:
code = err.faultCode
=== modified file 'GTG/plugins/bugzilla/notification.py'
--- GTG/plugins/bugzilla/notification.py 2013-06-04 13:54:42 +0000
+++ GTG/plugins/bugzilla/notification.py 2013-07-03 00:35:31 +0000
@@ -18,7 +18,12 @@
pynotify.init(APP_NAME)
nt = pynotify.Notification(title, message)
nt.set_timeout(TIMEOUT)
- nt.show()
+ try:
+ nt.show()
+ except:
+ # Keep quiet here when notification service is not avialable currently
+ # sometime. For example, if user is using LXDE, no notifyd by default.
+ pass
def _notify_via_notify_send(title, message):