Various lint cleanup

This commit is contained in:
David Cramer 2015-03-09 17:27:16 -07:00
parent 6c7eb1c863
commit 79046df5b3
2 changed files with 10 additions and 21 deletions

View File

@ -6,9 +6,6 @@ sentry_redmine.plugin
:license: BSD, see LICENSE for more details.
"""
import sys
import logging
from pprint import pformat
from django import forms
from django.utils.translation import ugettext_lazy as _
@ -68,8 +65,10 @@ class RedminePlugin(IssuePlugin):
def create_issue(self, group, form_data, **kwargs):
"""Create a Redmine issue"""
headers = { "X-Redmine-API-Key": self.get_option('key', group.project),
'content-type': 'application/json' }
headers = {
"X-Redmine-API-Key": self.get_option('key', group.project),
"Content-Type": "application/json",
}
url = urlparse.urljoin(self.get_option('host', group.project), "issues.json")
payload = {
'project_id': self.get_option('project_id', group.project),
@ -78,16 +77,12 @@ class RedminePlugin(IssuePlugin):
'subject': form_data['title'].encode('utf-8'),
'description': form_data['description'].encode('utf-8'),
}
#print >> sys.stderr, "url:", url
#print >> sys.stderr, "payload:\n", pformat(payload)
#print >> sys.stderr, pformat(group)
#print >> sys.stderr, pformat(dir(group))
session = http.build_session()
r = session.post(url, data=json.dumps({'issue': payload}), headers=headers)
data = json.loads(r.text)
if not 'issue' in data or not 'id' in data['issue']:
if 'issue' not in data or 'id' not in data['issue']:
raise Exception('Unable to create redmine ticket')
return data['issue']['id']

View File

@ -3,19 +3,15 @@
sentry-redmine
==================
An extension for Sentry which integrates with Redmine. Specifically, it allows you to easily create
Maniphest tasks from events within Sentry.
An extension for Sentry which integrates with Redmine. Specifically, it allows
you to easily create Redmine tickets from events within Sentry.
:copyright: (c) 2011 by the Sentry Team, see AUTHORS for more details.
:copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from setuptools import setup, find_packages
tests_require = [
'nose',
]
install_requires = [
'sentry>=7.3.0',
]
@ -32,15 +28,13 @@ setup(
packages=find_packages(exclude=['tests']),
zip_safe=False,
install_requires=install_requires,
tests_require=tests_require,
extras_require={'test': tests_require},
test_suite='runtests.runtests',
include_package_data=True,
entry_points={
'sentry.apps': [
'sentry.apps': [
'redmine = sentry_redmine',
],
'sentry.plugins': [
'sentry.plugins': [
'redmine = sentry_redmine.plugin:RedminePlugin'
],
},