pep8
This commit is contained in:
parent
fe297c8a7d
commit
e75383bb2f
4 changed files with 25 additions and 17 deletions
|
@ -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 <a href="%s" class="label" ' \
|
||||
'style="%s">%s</a> 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:
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -14,6 +14,7 @@ def boolean(value):
|
|||
return mark_safe('<span class="glyphicon glyphicon-'
|
||||
+ glyph + '" style="vertical-align: middle;"></span>')
|
||||
|
||||
|
||||
@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)
|
||||
|
|
|
@ -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.')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue