Permalink
Browse files

Correctly create an issue when an exception is raised

  • Loading branch information...
1 parent f42ce3c commit b89f0955649c289329419091f0d62b8788e5309f @cnorthwood cnorthwood committed Nov 9, 2010
Showing with 11 additions and 6 deletions.
  1. +2 −0 .gitignore
  2. +9 −6 django_jira/middleware.py
View
@@ -0,0 +1,2 @@
+*.pyc
+build
View
@@ -1,9 +1,10 @@
import traceback
import hashlib
+import sys
from django.conf import settings
from django.core.exceptions import MiddlewareNotUsed
-import SOAPpy
+import suds.client
class JiraExceptionReporterMiddleware:
@@ -23,10 +24,10 @@ def __init__(self):
settings.JIRA_ISSUE_DEFAULTS
# Set up SOAP
- self._soap = SOAPpy.WSDL.Proxy(settings.JIRA_URL + 'rpc/soap/jirasoapservice-v2?wsdl')
+ self._soap = suds.client.Client(settings.JIRA_URL + 'rpc/soap/jirasoapservice-v2?wsdl')
# Authenticate
- self._auth = self._soap.login(JIRA_USER, JIRA_PASSWORD)
+ self._auth = self._soap.service.login(settings.JIRA_USER, settings.JIRA_PASSWORD)
except AttributeError:
raise MiddlewareNotUsed
@@ -41,8 +42,10 @@ def process_exception(self, request, exc):
# Otherwise, create it
issue = settings.JIRA_ISSUE_DEFAULTS.copy()
- issue['summary'] = traceback.format_exception_only(type(exc))[0]
- issue['description'] = traceback.format_exc()
+ print exc
+ issue['summary'] = traceback.format_exception_only(type(exc), exc)[0]
+ issue['description'] = '{noformat:title=Traceback}\n' + traceback.format_exc() + '\n{noformat}\n\n' + \
+ '{noformat:title=Request}\n' + repr(request) + '\n{noformat}'
- self._soap.createIssue(self._auth, issue)
+ print self._soap.service.createIssue(self._auth, issue)

0 comments on commit b89f095

Please sign in to comment.