From e75383bb2f18efe96bd287888f4e3ee34224fda7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Wed, 20 Aug 2014 17:33:15 -0700 Subject: [PATCH] pep8 --- issue/models.py | 8 +++++--- issue/notifications.py | 16 ++++++++-------- issue/templatetags/issue_filters.py | 3 ++- issue/views.py | 15 ++++++++++----- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/issue/models.py b/issue/models.py index 6cf97a7..9c7fe5d 100644 --- a/issue/models.py +++ b/issue/models.py @@ -16,7 +16,7 @@ from colorful.fields import RGBColorField import json -from issue.templatetags.issue_tags import same_milestone, same_label, label_style, labeled +from issue.templatetags.issue_tags import * class User(auth.models.User): @@ -342,8 +342,10 @@ class Event(models.Model): action = 'removed' description = '%s the %s label' \ - % (action, same_label(label), label_style(label), label) - elif self.code == Event.SET_MILESTONE or self.code == Event.UNSET_MILESTONE: + % (action, same_label(label), + label_style(label), label) + elif self.code == Event.SET_MILESTONE \ + or self.code == Event.UNSET_MILESTONE: milestone = Milestone(name=args['milestone'], project=self.issue.project) if self.code == Event.SET_MILESTONE: diff --git a/issue/notifications.py b/issue/notifications.py index a79c370..5ff75b4 100644 --- a/issue/notifications.py +++ b/issue/notifications.py @@ -18,7 +18,7 @@ def notify_new_issue(issue): else: return - subject = "[%s] %s" %(project, issue.title) + subject = "[%s] %s" % (project, issue.title) data = [] for dest in dests: @@ -32,14 +32,14 @@ def notify_new_issue(issue): c = { 'description': issue.description, - 'uri': settings.BASE_URL \ - + reverse('show-issue', args=[project.name, issue.id]), + 'uri': settings.BASE_URL + reverse('show-issue', + args=[project.name, issue.id]), } message = render_to_string('emails/new_issue.html', c) data += [(subject, message, - "%s <%s>" %(issue.author.username, from_addr), [dest_addr])] + "%s <%s>" % (issue.author.username, from_addr), [dest_addr])] send_mass_mail(tuple(data)) @@ -70,7 +70,7 @@ def notify_event(event, template): else: return - subject = "Re: [%s] %s" %(project, issue.title) + subject = "Re: [%s] %s" % (project, issue.title) data = [] @@ -85,13 +85,13 @@ def notify_event(event, template): c = { 'comment': event.additionnal_section, - 'uri': settings.BASE_URL \ - + reverse('show-issue', args=[project.name, issue.id]), + 'uri': settings.BASE_URL + reverse('show-issue', + args=[project.name, issue.id]), } message = render_to_string('emails/%s.html' % template, c) data += [(subject, message, - '%s <%s>' %(event.author.username, from_addr), [dest_addr])] + '%s <%s>' % (event.author.username, from_addr), [dest_addr])] send_mass_mail(tuple(data)) diff --git a/issue/templatetags/issue_filters.py b/issue/templatetags/issue_filters.py index 68457e2..b6f3ca9 100644 --- a/issue/templatetags/issue_filters.py +++ b/issue/templatetags/issue_filters.py @@ -14,6 +14,7 @@ def boolean(value): return mark_safe('') + @register.filter def first_few(items, arg='item', max_items=5): if items.exists(): @@ -21,7 +22,7 @@ def first_few(items, arg='item', max_items=5): return ', '.join(map(lambda x: x.__str__(), items.all())) else: r = ', '.join(map(lambda x: x.__str__(), - items.all()[0:max_items-1])) + items.all()[0:max_items - 1])) plural = 's' if items.count() > max_items else '' r += ', ... (%s other%s)' \ % (items.count() - max_items + 1, plural) diff --git a/issue/views.py b/issue/views.py index 5877dbf..b33d706 100644 --- a/issue/views.py +++ b/issue/views.py @@ -938,11 +938,13 @@ def project_subscribe(request, project): user = User.objects.get(username=request.user.username) if project.subscribers.filter(username=user.username).exists(): - messages.warning(request, 'You are already subscribed to this project.') + messages.warning(request, + 'You are already subscribed to this project.') else: project.subscribers.add(user) project.save() - messages.success(request, 'You have been subscribed to this project successfully.') + messages.success(request, + 'You have been subscribed to this project successfully.') next = request.GET.get('next') if next: @@ -959,7 +961,8 @@ def project_unsubscribe(request, project): if project.subscribers.filter(username=user.username).exists(): project.subscribers.remove(user) project.save() - messages.success(request, 'You will not receive any notifications for this project anymore.') + messages.success(request, 'You will not receive any notifications ' + 'for this project anymore.') else: messages.warning(request, 'You are not subscribed to this project.') @@ -981,7 +984,8 @@ def issue_subscribe(request, project, issue): else: issue.subscribers.add(user) issue.save() - messages.success(request, 'You have been subscribed to this issue successfully.') + messages.success(request, + 'You have been subscribed to this issue successfully.') return redirect('show-issue', project.name, issue.id) @@ -995,7 +999,8 @@ def issue_unsubscribe(request, project, issue): if issue.subscribers.filter(username=user.username).exists(): issue.subscribers.remove(user) issue.save() - messages.success(request, 'You will not receive any notifications for this issue anymore.') + messages.success(request, 'You will not receive any notifications ' + 'for this issue anymore.') else: messages.warning(request, 'You are not subscribed to this issue.')