import xmlrpc.client as xmlrpclib
import argparse
import string
-import tempfile
import subprocess
import base64
try:
else:
self.d['state_id'] = id
- if self.project != None:
+ if self.project is not None:
id = project_id_by_name(rpc, self.project)
if id == 0:
sys.stderr.write("Note: No Project found matching %s, "
xmlrpclib.SafeTransport.__init__(self)
def authenticated(self):
- return self.username != None and self.password != None
+ return self.username is not None and self.password is not None
def send_host(self, connection, host):
xmlrpclib.Transport.send_host(self, connection, host)
def action_list(rpc, filter, submitter_str, delegate_str, format_str=None):
filter.resolve_ids(rpc)
- if submitter_str != None:
+ if submitter_str is not None:
ids = person_ids_by_name(rpc, submitter_str)
if len(ids) == 0:
sys.stderr.write("Note: Nobody found matching *%s*\n" %
list_patches(patches, format_str)
return
- if delegate_str != None:
+ if delegate_str is not None:
ids = person_ids_by_name(rpc, delegate_str)
if len(ids) == 0:
sys.stderr.write("Note: Nobody found matching *%s*\n" %
update_parser.error(
'Must specify one or more update options (-a or -s)')
- if args.get('n') != None:
+ if args.get('n') is not None:
try:
filt.add("max_count", args.get('n'))
except:
use_https)
else:
- sys.stderr.write(("The %s action requires authentication, "
- "but no username or password\nis configured\n") % action)
+ sys.stderr.write("The %s action requires authentication, but no "
+ "username or password\nis configured\n" % action)
sys.exit(1)
if project_str:
sys.exit(1)
# It should be safe to assume hash_str is not zero, but who knows..
- if hash_str != None:
+ if hash_str is not None:
patch_ids = [patch_id_from_hash(rpc, project_str, hash_str)]
# helper for non_empty() to print correct helptext
# Require either hash_str or IDs for
def non_empty(h, patch_ids):
"""Error out if no patch IDs were specified"""
- if patch_ids == None or len(patch_ids) < 1:
- sys.stderr.write("Error: Missing Argument! " +
- "Either [-h HASH] or [ID [ID ...]] are required\n")
+ if patch_ids is None or len(patch_ids) < 1:
+ sys.stderr.write("Error: Missing Argument! Either [-h HASH] or "
+ "[ID [ID ...]] are required\n")
if h:
h.print_help()
sys.exit(1)
return patch_ids
if action == 'list' or action == 'search':
- if args.get('patch_name') != None:
+ if args.get('patch_name') is not None:
filt.add("name__icontains", args.get('patch_name'))
action_list(rpc, filt, submitter_str, delegate_str, format_str)
def form(self):
if self.forced:
- return mark_safe('<input type="hidden" value="%s">%s' % (self.param,
- self.condition()))
+ return mark_safe('<input type="hidden" value="%s">%s' % (
+ self.param, self.condition()))
return self.condition()
return self._form()
str += '<option %s value="%s">any</option>' % (selected, self.any_key)
selected = ''
- if self.applied and self.state == None:
+ if self.applied and self.state is None:
selected = 'selected'
- str += '<option %s value="">%s</option>' % \
- (selected, self.action_req_str)
+ str += '<option %s value="">%s</option>' % (
+ selected, self.action_req_str)
for state in State.objects.all():
selected = ''
if self.state and self.state == state:
selected = ' selected="true"'
- str += '<option value="%d" %s>%s</option>' % \
- (state.id, selected, state.name)
+ str += '<option value="%d" %s>%s</option>' % (
+ state.id, selected, state.name)
str += '</select>'
return mark_safe(str)
self.param_map = {
True: 'true',
False: '',
- None: 'both'
+ None: 'both'
}
self.description_map = {
True: 'Yes',
for (k, v) in self.param_map.items():
if str == v:
self.archive_state = k
- if self.archive_state == None:
+ if self.archive_state is None:
self.applied = False
def kwargs(self):
- if self.archive_state == None:
+ if self.archive_state is None:
return {}
return {'archived': self.archive_state}
return self.description_map[self.archive_state]
def key(self):
- if self.archive_state == False:
+ if not self.archive_state:
return None
return self.param_map[self.archive_state]
self.delegate = None
return
- applied = False
try:
self.delegate = User.objects.get(id=str)
self.applied = True
if d == self.delegate:
selected = ' selected'
- str += '<option %s value="%s">%s</option>' % (selected,
- d.id, d.profile.name())
+ str += '<option %s value="%s">%s</option>' % (
+ selected, d.id, d.profile.name())
str += '</select>'
return mark_safe(str)
def clean_username(self):
value = self.cleaned_data['username']
try:
- user = User.objects.get(username__iexact=value)
+ User.objects.get(username__iexact=value)
except User.DoesNotExist:
return self.cleaned_data['username']
raise forms.ValidationError('This username is already taken. ' +
class BundleForm(forms.ModelForm):
- name = forms.RegexField(regex=r'^[^/]+$', max_length=50, label=u'Name',
- error_messages={'invalid': 'Bundle names can\'t contain slashes'})
+ name = forms.RegexField(
+ regex=r'^[^/]+$', max_length=50, label=u'Name',
+ error_messages={'invalid': 'Bundle names can\'t contain slashes'})
class Meta:
model = Bundle
data = self.cleaned_data
# Update the instance
for f in opts.fields:
- if not f.name in data:
+ if f.name not in data:
continue
field = self.fields.get(f.name, None)
if request.user.is_authenticated():
patches_per_page = request.user.profile.patches_per_page
- n = request.META.get('ppp')
- if n:
+ ppp = request.META.get('ppp')
+ if ppp:
try:
- patches_per_page = int(n)
+ patches_per_page = int(ppp)
except ValueError:
pass
pages = self.num_pages
if pages <= LEADING_PAGE_RANGE_DISPLAYED:
- self.adjacent_set = [n for n in range(1, pages + 1)
- if n > 0 and n <= pages]
+ adjacent_start = 1
+ adjacent_end = pages + 1
elif page_no <= LEADING_PAGE_RANGE:
- self.adjacent_set = [n for n in
- range(1, LEADING_PAGE_RANGE_DISPLAYED + 1)
- if n > 0 and n <= pages]
+ adjacent_start = 1
+ adjacent_end = LEADING_PAGE_RANGE_DISPLAYED + 1
self.leading_set = [n + pages for n in
range(0, -NUM_PAGES_OUTSIDE_RANGE, -1)]
elif page_no > pages - TRAILING_PAGE_RANGE:
- self.adjacent_set = [n for n in
- range(pages - TRAILING_PAGE_RANGE_DISPLAYED + 1,
- pages + 1) if n > 0 and n <= pages]
- self.trailing_set = [n + 1 for n in range(0,
- NUM_PAGES_OUTSIDE_RANGE)]
+ adjacent_start = pages - TRAILING_PAGE_RANGE_DISPLAYED + 1
+ adjacent_end = pages + 1
+ self.trailing_set = [n + 1 for n in
+ range(0, NUM_PAGES_OUTSIDE_RANGE)]
else:
- self.adjacent_set = [n for n in range(page_no - ADJACENT_PAGES,
- page_no + ADJACENT_PAGES + 1) if n > 0 and n <= pages]
+ adjacent_start = page_no - ADJACENT_PAGES
+ adjacent_end = page_no + ADJACENT_PAGES + 1
self.leading_set = [n + pages for n in
range(0, -NUM_PAGES_OUTSIDE_RANGE, -1)]
self.trailing_set = [n + 1 for n in
range(0, NUM_PAGES_OUTSIDE_RANGE)]
+ self.adjacent_set = [n for n in range(adjacent_start, adjacent_end)
+ if n > 0 and n <= pages]
+
self.leading_set.reverse()
- self.long_page = \
- len(self.current_page.object_list) >= LONG_PAGE_THRESHOLD
+ self.long_page = len(
+ self.current_page.object_list) >= LONG_PAGE_THRESHOLD
if line.startswith('--- '):
state = 2
- if line.startswith('rename from ') or line.startswith('rename to '):
+ if line.startswith(('rename from ', 'rename to ')):
state = 6
elif state == 2:
state = 5
elif state == 6:
- if line.startswith('rename to ') or line.startswith('rename from '):
+ if line.startswith(('rename to ', 'rename from ')):
patchbuf += buf + line
buf = ''
from django.conf import settings
from django.contrib.sites.models import Site
from django.template import RequestContext
-from django.utils.html import escape
from patchwork.filters import Filters
from patchwork.models import Bundle, Project
import django
-from .base import *
+from .base import * # noqa
#
# Core settings
from __future__ import absolute_import
-from .base import *
+from .base import * # noqa
#
# Core settings
from __future__ import absolute_import
-import re
-
from django.core.urlresolvers import reverse
from django import template
from django.utils.html import escape
from django.conf import settings
from django.test import TestCase
-from django.test.client import Client
from django.utils.http import urlencode
from patchwork.models import Patch, Bundle, BundlePatch, Person
def checkPatchformErrors(self, response):
formname = 'patchform'
- if not formname in response.context:
+ if formname not in response.context:
return
form = response.context[formname]
if not form:
self.assertEqual(bundle.public, self.bundle.public)
def testUpdatePublic(self):
- newname = 'newbundlename'
data = {
'form': 'bundle',
'action': 'update',
# first, check that we can modify with the owner
self.client.login(username=self.user.username,
password=self.user.username)
- response = self.client.post(bundle_url(self.bundle), data)
+ self.client.post(bundle_url(self.bundle), data)
self.bundle = Bundle.objects.get(pk=self.bundle.pk)
self.assertEqual(self.bundle.name, newname)
# log in with a different user, and check that we can no longer modify
self.client.login(username=self.other_user.username,
password=self.other_user.username)
- response = self.client.post(bundle_url(self.bundle), data)
+ self.client.post(bundle_url(self.bundle), data)
self.bundle = Bundle.objects.get(pk=self.bundle.pk)
self.assertNotEqual(self.bundle.name, newname)
self.assertEqual(bundle.patches.all()[0], patch)
def testCreateNonEmptyBundleEmptyName(self):
- newbundlename = 'testbundle-new'
patch = self.patches[0]
n_bundles = Bundle.objects.count()
response = self.client.post('/patch/%d/' % patch.id, params)
- self.assertContains(response,
- 'A bundle called %s already exists' % newbundlename)
+ self.assertContains(
+ response,
+ 'A bundle called %s already exists' % newbundlename)
- count = Bundle.objects.count()
self.assertEqual(Bundle.objects.count(), 1)
response = self.client.post('/patch/%d/' % patch.id, params)
- self.assertContains(response,
- 'added to bundle "%s"' % self.bundle.name,
- count=1)
+ self.assertContains(
+ response,
+ 'added to bundle "%s"' % self.bundle.name,
+ count=1)
self.assertEqual(self.bundle.patches.count(), 1)
self.assertEqual(self.bundle.patches.all()[0], patch)
response = self.client.post('/patch/%d/' % patch.id, params)
- self.assertContains(response,
- 'added to bundle "%s"' % self.bundle.name,
- count=1)
+ self.assertContains(
+ response,
+ 'added to bundle "%s"' % self.bundle.name,
+ count=1)
self.assertEqual(self.bundle.patches.count(), 2)
self.assertIn(self.patches[0], self.bundle.patches.all())
from datetime import datetime as dt
from datetime import timedelta
-from django.conf import settings
-from django.db import connection
from django.test import TransactionTestCase
from patchwork.models import Patch, Check
self.assertChecksEqual(self.patch, [check_a, check_b])
def test_checks__duplicate_checks(self):
- check_a = self.create_check(date=(dt.now() - timedelta(days=1)))
- check_b = self.create_check()
+ self.create_check(date=(dt.now() - timedelta(days=1)))
+ check = self.create_check()
# this isn't a realistic scenario (dates shouldn't be set by user so
# they will always increment), but it's useful to verify the removal
# of older duplicates by the function
- check_c = self.create_check(date=(dt.now() - timedelta(days=2)))
- self.assertChecksEqual(self.patch, [check_b])
+ self.create_check(date=(dt.now() - timedelta(days=2)))
+ self.assertChecksEqual(self.patch, [check])
def test_check_count__no_checks(self):
self.assertCheckCountEqual(self.patch, 0)
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import os
-import time
-import unittest
-
from django.test.client import Client
from django.test import TestCase
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import datetime
-import unittest
from django.contrib.auth.models import User
from django.test import TestCase
date = ((datetime.datetime.now() - EmailConfirmation.validity) -
datetime.timedelta(hours=1))
userid = 'test-user'
- user = User.objects.create_user(userid,
- defaults.patch_author_person.email, userid)
+ user = User.objects.create_user(
+ userid,
+ defaults.patch_author_person.email, userid)
user.is_active = False
user.date_joined = user.last_login = date
user.save()
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
-
from django.test import TestCase
-from django.test.client import Client
-from patchwork.tests.utils import defaults, create_user, find_in_context
+from patchwork.tests.utils import defaults
class FilterQueryStringTest(TestCase):
from __future__ import absolute_import
import datetime
-import random
import re
-import string
-import unittest
from django.core.urlresolvers import reverse
-from django.test.client import Client
from django.test import TestCase
from django.utils.six.moves import zip
from patchwork.models import Person, Patch
-from patchwork.tests.utils import defaults, create_user, find_in_context
+from patchwork.tests.utils import defaults
class EmptyPatchListTest(TestCase):
import dateutil.parser
import dateutil.tz
import email
-import unittest
-from django.test.client import Client
from django.test import TestCase
-from patchwork.models import Patch, Comment, Person
-from patchwork.tests.utils import defaults, create_user, find_in_context
+from patchwork.models import Patch, Comment
+from patchwork.tests.utils import defaults
class MboxPatchResponseTest(TestCase):
from email import message_from_string
from email.mime.text import MIMEText
from email.utils import make_msgid
-import os
from django.test import TestCase
class MultipleProjectPatchCommentTest(MultipleProjectPatchTest):
- """ Test that followups to multiple-project patches end up on the
- correct patch """
+ """Test that followups to multiple-project patches end up on the
+ correct patch."""
comment_msgid = '<2@example.com>'
comment_content = 'test comment'
def testParsedComment(self):
for project in [self.p1, self.p2]:
patch = Patch.objects.filter(project=project)[0]
- # we should see two comments now - the original mail with the patch,
- # and the one we parsed in setUp()
+ # we should see two comments now - the original mail with the
+ # patch, and the one we parsed in setUp()
self.assertEqual(Comment.objects.filter(patch=patch).count(), 2)
class ListIdHeaderTest(TestCase):
- """ Test that we parse List-Id headers from mails correctly """
+ """Test that we parse List-Id headers from mails correctly."""
def setUp(self):
self.project = Project(linkname='test-project-1', name='Project 1',
- listid='1.example.com', listemail='1@example.com')
+ listid='1.example.com',
+ listemail='1@example.com')
self.project.save()
def testNoListId(self):
def testGitPullWithDiff(self):
(patch, comment) = find_content(self.project, self.mail)
self.assertTrue(patch is not None)
- self.assertEqual('git://git.kernel.org/pub/scm/linux/kernel/git/tip/' +
- 'linux-2.6-tip.git x86-fixes-for-linus', patch.pull_url)
+ self.assertEqual('git://git.kernel.org/pub/scm/linux/kernel/git/tip/'
+ 'linux-2.6-tip.git x86-fixes-for-linus',
+ patch.pull_url)
self.assertTrue(
patch.content.startswith(
'diff --git a/arch/x86/include/asm/smp.h'),
from __future__ import absolute_import
import json
-import unittest
-
-from django.test.client import Client
from django.test import TestCase
from django.utils.six.moves import map, range
-from patchwork.models import EmailConfirmation, Person, Bundle
+from patchwork.models import Person
class SubmitterCompletionTest(TestCase):
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
-
from django.contrib.auth.models import User
from django.core import mail
from django.core.urlresolvers import reverse
response = self.client.post('/register/', data)
self.assertEqual(response.status_code, 200)
self.assertFormError(response, 'form', 'username',
- 'This username is already taken. Please choose another.')
+ 'This username is already taken. Please choose '
+ 'another.')
def testExistingEmail(self):
user = create_user()
response = self.client.post('/register/', data)
self.assertEqual(response.status_code, 200)
self.assertFormError(response, 'form', 'email',
- 'This email address is already in use ' +
+ 'This email address is already in use '
'for the account "%s".\n' % user.username)
def testValidRegistration(self):
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import datetime
-import unittest
from django.conf import settings
-from django.db import connection
from django.test import TestCase, TransactionTestCase
from patchwork.models import Project, Patch, Comment, Tag, PatchTag
def testDelegateChangeValid(self):
delegate = create_maintainer(defaults.project)
- response = self._testDelegateChange(str(delegate.pk))
+ self._testDelegateChange(str(delegate.pk))
for p in self.patches:
self.assertEqual(Patch.objects.get(pk=p.pk).delegate, delegate)
def testDelegateClear(self):
- response = self._testDelegateChange('')
+ self._testDelegateChange('')
for p in self.patches:
self.assertEqual(Patch.objects.get(pk=p.pk).delegate, None)
old_ppp = user_profile.patches_per_page
new_ppp = old_ppp + 1
- response = self.client.post('/user/', {'patches_per_page': new_ppp})
+ self.client.post('/user/', {'patches_per_page': new_ppp})
user_profile = UserProfile.objects.get(user=self.user.user.id)
self.assertEqual(user_profile.patches_per_page, new_ppp)
old_ppp = user_profile.patches_per_page
new_ppp = -1
- response = self.client.post('/user/', {'patches_per_page': new_ppp})
+ self.client.post('/user/', {'patches_per_page': new_ppp})
user_profile = UserProfile.objects.get(user=self.user.user.id)
self.assertEqual(user_profile.patches_per_page, old_ppp)
from django.test import LiveServerTestCase
from django.utils.six.moves import xmlrpc_client
-from patchwork.models import Person, Patch
+from patchwork.models import Patch
from patchwork.tests.utils import defaults
@unittest.skipUnless(settings.ENABLE_XMLRPC,
- "requires xmlrpc interface (use the ENABLE_XMLRPC setting)")
+ 'requires xmlrpc interface (use the ENABLE_XMLRPC '
+ 'setting)')
class XMLRPCTest(LiveServerTestCase):
fixtures = ['default_states']
import os
from django.contrib.auth.models import User
-from django.forms.fields import EmailField
from patchwork.models import Project, Person
(r'^user/todo/$', 'patchwork.views.user.todo_lists'),
(r'^user/todo/(?P<project_id>[^/]+)/$', 'patchwork.views.user.todo_list'),
- (r'^user/bundles/$',
- 'patchwork.views.bundle.bundles'),
+ (r'^user/bundles/$', 'patchwork.views.bundle.bundles'),
(r'^user/link/$', 'patchwork.views.user.link'),
(r'^user/unlink/(?P<person_id>[^/]+)/$', 'patchwork.views.user.unlink'),
urlpatterns += patterns(
'',
(r'^user/bundle/(?P<bundle_id>[^/]+)/$',
- 'patchwork.views.bundle.bundle_redir'),
+ 'patchwork.views.bundle.bundle_redir'),
(r'^user/bundle/(?P<bundle_id>[^/]+)/mbox/$',
- 'patchwork.views.bundle.mbox_redir'),
+ 'patchwork.views.bundle.mbox_redir'),
)
from django.contrib.sites.models import Site
from django.core.mail import EmailMessage
from django.db.models import Max, Q, F
-from django.db.utils import IntegrityError
from django.shortcuts import get_object_or_404
from django.template.loader import render_to_string
-from patchwork.models import (Bundle, Project, BundlePatch, UserProfile,
- PatchChangeNotification, EmailOptout,
- EmailConfirmation)
+from patchwork.models import (Bundle, BundlePatch, PatchChangeNotification,
+ EmailOptout, EmailConfirmation)
def get_patch_ids(d, prefix='patch_id'):
class Order(object):
order_map = {
- 'date': 'date',
- 'name': 'name',
- 'state': 'state__ordering',
- 'submitter': 'submitter__name',
- 'delegate': 'delegate__username',
+ 'date': 'date',
+ 'name': 'name',
+ 'state': 'state__ordering',
+ 'submitter': 'submitter__name',
+ 'delegate': 'delegate__username',
}
default_order = ('date', True)
def send_notifications():
- date_limit = datetime.datetime.now() - \
- datetime.timedelta(minutes=settings.NOTIFICATION_DELAY_MINUTES)
+ date_limit = datetime.datetime.now() - datetime.timedelta(
+ minutes=settings.NOTIFICATION_DELAY_MINUTES)
# This gets funky: we want to filter out any notifications that should
# be grouped with other notifications that aren't ready to go out yet. To
# do that, we join back onto PatchChangeNotification (PCN -> Patch ->
# Person -> Patch -> max(PCN.last_modified)), filtering out any maxima
# that are with the date_limit.
- qs = PatchChangeNotification.objects \
- .annotate(m=Max('patch__submitter__patch__patchchangenotification'
- '__last_modified')) \
- .filter(m__lt=date_limit)
+ qs = PatchChangeNotification.objects.annotate(
+ m=Max('patch__submitter__patch__patchchangenotification'
+ '__last_modified')).filter(m__lt=date_limit)
groups = itertools.groupby(qs.order_by('patch__submitter'),
lambda n: n.patch.submitter)
try:
message.send()
- except ex:
+ except Exception as ex:
errors.append((recipient, ex))
continue
# expire inactive users with no pending confirmation
pending_confs = EmailConfirmation.objects.values('user')
- users = User.objects.filter(
- is_active=False,
- last_login=F('date_joined')
- ).exclude(
- id__in=pending_confs
- )
+ users = User.objects.filter(is_active=False,
+ last_login=F('date_joined')).exclude(
+ id__in=pending_confs)
# delete users
users.delete()
import email.utils
import re
-from .base import *
+from .base import * # noqa
from patchwork.utils import Order, get_patch_ids, bundle_actions, set_bundle
from patchwork.paginator import Paginator
from patchwork.forms import MultiplePatchForm
-from patchwork.models import Comment
+from patchwork.models import Comment, Patch
def generic_list(request, project, view,
paginator = Paginator(request, patches)
context.update({
- 'page': paginator.current_page,
- 'patchform': properties_form,
- 'project': project,
- 'order': order,
+ 'page': paginator.current_page,
+ 'patchform': properties_form,
+ 'project': project,
+ 'order': order,
})
return context
from django.shortcuts import render_to_response, get_object_or_404
from django.template.loader import render_to_string
-from patchwork.models import Patch, Project, Person, EmailConfirmation
+from patchwork.models import Project, Person, EmailConfirmation
from patchwork.requestcontext import PatchworkRequestContext
return HttpResponse(json.dumps(data), content_type="application/json")
-help_pages = {'': 'index.html',
- 'about/': 'about.html',
+help_pages = {'': 'index.html',
+ 'about/': 'about.html',
}
if settings.ENABLE_XMLRPC:
def help(request, path):
context = PatchworkRequestContext(request)
if path in help_pages:
- return render_to_response('patchwork/help/' + help_pages[path], context)
+ return render_to_response(
+ 'patchwork/help/' + help_pages[path], context)
raise Http404
from __future__ import absolute_import
from django.contrib.auth.decorators import login_required
-from django.contrib.auth.models import User
import django.core.urlresolvers
-from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
+from django.http import (HttpResponse, HttpResponseRedirect,
+ HttpResponseNotFound)
from django.shortcuts import render_to_response, get_object_or_404
from patchwork.filters import DelegateFilter
bundle.save()
elif action == 'add':
bundle = get_object_or_404(Bundle,
- owner=request.user, id=request.POST['id'])
+ owner=request.user,
+ id=request.POST['id'])
bundle.save()
patch_id = request.get('patch_id', None)
else:
form = BundleForm(instance=bundle)
- if request.method == 'POST' and \
- request.POST.get('form') == 'reorderform':
- order = get_object_or_404(BundlePatch, bundle=bundle,
- patch__id=request.POST.get('order_start')).order
+ if (request.method == 'POST' and
+ request.POST.get('form') == 'reorderform'):
+ order = get_object_or_404(
+ BundlePatch,
+ bundle=bundle,
+ patch__id=request.POST.get('order_start')).order
for patch_id in request.POST.getlist('neworder'):
bundlepatch = get_object_or_404(BundlePatch,
- bundle=bundle, patch__id=patch_id)
+ bundle=bundle,
+ patch__id=patch_id)
bundlepatch.order = order
bundlepatch.save()
order += 1
conf_settings.DEFAULT_FROM_EMAIL, [email])
context['email'] = mail
context['email_sent'] = True
- except Exception as ex:
- context['error'] = 'An error occurred during confirmation . ' + \
- 'Please try again later.'
+ except Exception:
+ context['error'] = ('An error occurred during confirmation . '
+ 'Please try again later.')
context['admins'] = conf_settings.ADMINS
return render_to_response(html_template, context)
mail_ctx = {'site': Site.objects.get_current(),
'confirmation': conf}
- subject = render_to_string('patchwork/activation_email_subject.txt',
- mail_ctx).replace('\n', ' ').strip()
+ subject = render_to_string(
+ 'patchwork/activation_email_subject.txt',
+ mail_ctx).replace('\n', ' ').strip()
message = render_to_string('patchwork/activation_email.txt',
mail_ctx)