from django.contrib import admin
-from patchwork.models import (
- Project, Person, UserProfile, State, Patch, Comment, Bundle, Tag, Check)
+from patchwork.models import (Project, Person, UserProfile, State, Patch,
+ Comment, Bundle, Tag, Check)
class ProjectAdmin(admin.ModelAdmin):
from __future__ import print_function
-import sys
-import subprocess
from optparse import OptionParser
+import subprocess
+import sys
def commits(options, revlist):
cmd = ['git', 'rev-list', revlist]
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
from __future__ import absolute_import
-from patchwork.models import Person, State
-from django.utils.safestring import mark_safe
-from django.utils.html import escape
-from django.contrib.auth.models import User
from urllib import quote
+from django.contrib.auth.models import User
+from django.utils.html import escape
+from django.utils.safestring import mark_safe
+
+from patchwork.models import Person, State
+
+
class Filter(object):
def __init__(self, filters):
self.filters = filters
from patchwork.models import Patch, State, Bundle, UserProfile
+
class RegistrationForm(forms.Form):
first_name = forms.CharField(max_length = 30, required = False)
last_name = forms.CharField(max_length = 30, required = False)
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.core.management.base import BaseCommand
+
from patchwork.utils import send_notifications, do_expiry
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.core.management.base import BaseCommand
+
from patchwork.models import Patch
from __future__ import absolute_import
-from django.core import paginator
from django.conf import settings
+from django.core import paginator
+
DEFAULT_PATCHES_PER_PAGE = 100
LONG_PAGE_THRESHOLD = 30
from __future__ import absolute_import
from __future__ import print_function
+from collections import Counter
import hashlib
import re
-from collections import Counter
+
_hunk_re = re.compile('^\@\@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? \@\@')
_filename_re = re.compile('^(---|\+\+\+) (\S+)')
from __future__ import absolute_import
+from django.conf import settings
+from django.contrib.sites.models import Site
from django.template import RequestContext
from django.utils.html import escape
-from django.contrib.sites.models import Site
-from django.conf import settings
+
from patchwork.filters import Filters
from patchwork.models import Bundle, Project
from __future__ import absolute_import
+from django.conf import settings
+from django.core.urlresolvers import reverse, NoReverseMatch
from django import template
-from django.utils.html import escape
from django.utils.encoding import smart_str
+from django.utils.html import escape
+
from patchwork.filters import filterclasses
-from django.conf import settings
-from django.core.urlresolvers import reverse, NoReverseMatch
+
register = template.Library()
from patchwork.models import Check
-register = template.Library()
+register = template.Library()
@register.filter(name='patch_tags')
def patch_tags(patch):
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.utils.safestring import mark_safe
-from django.core.urlresolvers import reverse
+
from patchwork.filters import SubmitterFilter
-import re
+
register = template.Library()
from __future__ import absolute_import
+import re
+
from django import template
from django.utils.html import escape
from django.utils.safestring import mark_safe
-import re
+
register = template.Library()
from __future__ import absolute_import
-import unittest
import datetime
+import unittest
+
+from django.conf import settings
from django.test import TestCase
from django.test.client import Client
from django.utils.http import urlencode
-from django.conf import settings
+
from patchwork.models import Patch, Bundle, BundlePatch, Person
from patchwork.tests.utils import defaults, create_user, find_in_context
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from datetime import datetime as dt, timedelta
+from datetime import datetime as dt
+from datetime import timedelta
from django.conf import settings
from django.db import connection
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.test import TestCase
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+from django.test import TestCase
+
from patchwork.models import EmailConfirmation, Person
+
def _confirmation_url(conf):
return reverse('patchwork.views.confirm', kwargs = {'key': conf.key})
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import time
+import unittest
+
+from django.test.client import Client
+from django.test import TestCase
+
from patchwork.models import Patch, Person
from patchwork.tests.utils import defaults, read_patch
-from django.test import TestCase
-from django.test.client import Client
+
class UTF8PatchViewTest(TestCase):
fixtures = ['default_states']
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import datetime
-from django.test import TestCase
+import unittest
+
from django.contrib.auth.models import User
+from django.test import TestCase
+
from patchwork.models import EmailConfirmation, Person, Patch
from patchwork.tests.utils import create_user, defaults
from patchwork.utils import do_expiry
+
class TestRegistrationExpiry(TestCase):
fixtures = ['default_states']
# 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
+
class FilterQueryStringTest(TestCase):
def testFilterQSEscaping(self):
"""test that filter fragments in a query string are properly escaped,
from __future__ import absolute_import
-import unittest
-import random
import datetime
-import string
+import random
import re
-from django.test import TestCase
+import string
+import unittest
+
+from django.core.urlresolvers import reverse
from django.test.client import Client
-from patchwork.tests.utils import defaults, create_user, find_in_context
+from django.test import TestCase
+
from patchwork.models import Person, Patch
-from django.core.urlresolvers import reverse
+from patchwork.tests.utils import defaults, create_user, find_in_context
+
class EmptyPatchListTest(TestCase):
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import re
-from django.test import TestCase
+
from django.core import mail
from django.core.urlresolvers import reverse
+from django.test import TestCase
+
from patchwork.models import EmailOptout, EmailConfirmation, Person
from patchwork.tests.utils import create_user, error_strings
+
class MailSettingsTest(TestCase):
def setUp(self):
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
-import email
import datetime
-import dateutil.parser, dateutil.tz
-from django.test import 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
+
class MboxPatchResponseTest(TestCase):
fixtures = ['default_states']
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import datetime
-from django.test import TestCase
-from django.core import mail
+
from django.conf import settings
+from django.core import mail
+from django.test import TestCase
+
from patchwork.models import Patch, State, PatchChangeNotification, EmailOptout
from patchwork.tests.utils import defaults
from patchwork.utils import send_notifications
+
class PatchNotificationModelTest(TestCase):
fixtures = ['default_states']
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import os
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
-from patchwork.models import Project, Person, Patch, Comment, State, \
- get_default_initial_patch_state
-from patchwork.tests.utils import read_patch, read_mail, create_email, \
- defaults, create_user
-from email.mime.text import MIMEText
+from patchwork.bin.parsemail import (find_content, find_author,
+ find_project_by_header, parse_mail,
+ split_prefixes, clean_subject)
+from patchwork.models import (Project, Person, Patch, Comment, State,
+ get_default_initial_patch_state)
+from patchwork.tests.utils import (read_patch, read_mail, create_email,
+ defaults, create_user)
+
class PatchTest(TestCase):
fixtures = ['default_states']
default_subject = defaults.subject
project = defaults.project
-from patchwork.bin.parsemail import (find_content, find_author,
- find_project_by_header, parse_mail,
- split_prefixes, clean_subject)
class InlinePatchTest(PatchTest):
patch_filename = '0001-add-line.patch'
from __future__ import absolute_import
+import json
import unittest
-from django.test import TestCase
+
from django.test.client import Client
+from django.test import TestCase
+
from patchwork.models import EmailConfirmation, Person, Bundle
-import json
class SubmitterCompletionTest(TestCase):
def setUp(self):
# 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 django.contrib.auth.models import User
from django.core import mail
from django.core.urlresolvers import reverse
-from django.contrib.auth.models import User
+from django.test.client import Client
+from django.test import TestCase
+
from patchwork.models import EmailConfirmation, Person
from patchwork.tests.utils import create_user
+
def _confirmation_url(conf):
return reverse('patchwork.views.confirm', kwargs = {'key': conf.key})
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
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
-from patchwork.tests.utils import defaults
from patchwork.parser import extract_tags
+from patchwork.tests.utils import defaults
-from django.conf import settings
-from django.db import connection
class ExtractTagsTest(TestCase):
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.test import TestCase
from django.core.urlresolvers import reverse
+from django.test import TestCase
+
from patchwork.models import Patch, Person, State
from patchwork.tests.utils import defaults, create_maintainer
+
class MultipleUpdateTest(TestCase):
fixtures = ['default_states']
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.test import TestCase
-from django.core import mail
-from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.auth.models import User
+from django.core import mail
+from django.core.urlresolvers import reverse
+from django.test import TestCase
+
from patchwork.models import EmailConfirmation, Person, Bundle, UserProfile
from patchwork.tests.utils import defaults, error_strings
from patchwork.tests.browser import SeleniumTestCase
from patchwork.tests.test_user import TestUser
+
class LoginTestCase(SeleniumTestCase):
def setUp(self):
super(LoginTestCase, self).setUp()
import unittest
import xmlrpclib
-from django.test import LiveServerTestCase
-from django.core.urlresolvers import reverse
+
from django.conf import settings
+from django.core.urlresolvers import reverse
+from django.test import LiveServerTestCase
+
from patchwork.models import Person, Patch
from patchwork.tests.utils import defaults
+
@unittest.skipUnless(settings.ENABLE_XMLRPC,
"requires xmlrpc interface (use the ENABLE_XMLRPC setting)")
class XMLRPCTest(LiveServerTestCase):
# 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 codecs
-from patchwork.models import Project, Person
-from django.contrib.auth.models import User
-from django.forms.fields import EmailField
-
from email import message_from_file
-from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
+from email.mime.text import MIMEText
from email.utils import make_msgid
+import os
+
+from django.contrib.auth.models import User
+from django.forms.fields import EmailField
+
+from patchwork.models import Project, Person
# helper functions for tests
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.conf.urls import patterns, url, include
from django.conf import settings
+from django.conf.urls import patterns, url, include
from django.contrib import admin
from django.contrib.auth import views as auth_views
+
admin.autodiscover()
urlpatterns = patterns('',
from __future__ import absolute_import
-import itertools
import datetime
-from django.shortcuts import get_object_or_404
-from django.template.loader import render_to_string
+import itertools
+
+from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
-from django.conf import settings
from django.core.mail import EmailMessage
from django.db.models import Max, Q, F
from django.db.utils import IntegrityError
-from patchwork.models import Bundle, Project, BundlePatch, UserProfile, \
- PatchChangeNotification, EmailOptout, EmailConfirmation
+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)
def get_patch_ids(d, prefix = 'patch_id'):
ids = []
from __future__ import absolute_import
+import datetime
+from email.encoders import encode_7or8bit
+from email.header import Header
+from email.mime.nonmultipart import MIMENonMultipart
+from email.parser import HeaderParser
+import email.utils
+import re
+
from .base import *
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
-import re
-import datetime
-
-from email.mime.nonmultipart import MIMENonMultipart
-from email.encoders import encode_7or8bit
-from email.parser import HeaderParser
-from email.header import Header
-import email.utils
def generic_list(request, project, view,
view_args = {}, filter_settings = [], patches = None,
import json
-from patchwork.models import Patch, Project, Person, EmailConfirmation
-from django.shortcuts import render_to_response, get_object_or_404
-from django.http import HttpResponse, HttpResponseRedirect, Http404
-from patchwork.requestcontext import PatchworkRequestContext
-from django.core import urlresolvers
-from django.template.loader import render_to_string
from django.conf import settings
+from django.core import urlresolvers
from django.db.models import Q
+from django.http import HttpResponse, HttpResponseRedirect, Http404
+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.requestcontext import PatchworkRequestContext
def projects(request):
context = PatchworkRequestContext(request)
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
-from django.shortcuts import render_to_response, get_object_or_404
-from patchwork.requestcontext import PatchworkRequestContext
-from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
import django.core.urlresolvers
+from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
+from django.shortcuts import render_to_response, get_object_or_404
+
+from patchwork.filters import DelegateFilter
+from patchwork.forms import BundleForm, DeleteBundleForm
from patchwork.models import Patch, Bundle, BundlePatch, Project
+from patchwork.requestcontext import PatchworkRequestContext
from patchwork.utils import get_patch_ids
-from patchwork.forms import BundleForm, DeleteBundleForm
from patchwork.views import generic_list, patch_to_mbox
-from patchwork.filters import DelegateFilter
@login_required
def setbundle(request):
from __future__ import absolute_import
-from patchwork.requestcontext import PatchworkRequestContext
-from patchwork.models import EmailOptout, EmailConfirmation
-from patchwork.forms import OptinoutRequestForm, EmailForm
-from django.shortcuts import render_to_response
-from django.template.loader import render_to_string
from django.conf import settings as conf_settings
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
+from django.shortcuts import render_to_response
+from django.template.loader import render_to_string
+
+from patchwork.forms import OptinoutRequestForm, EmailForm
+from patchwork.models import EmailOptout, EmailConfirmation
+from patchwork.requestcontext import PatchworkRequestContext
def settings(request):
context = PatchworkRequestContext(request)
from __future__ import absolute_import
-from patchwork.models import Patch, Project, Bundle
+from django.http import HttpResponse, HttpResponseForbidden
+from django.shortcuts import render_to_response, get_object_or_404
+
from patchwork.forms import PatchForm, CreateBundleForm
+from patchwork.models import Patch, Project, Bundle
from patchwork.requestcontext import PatchworkRequestContext
-from django.shortcuts import render_to_response, get_object_or_404
-from django.http import HttpResponse, HttpResponseForbidden
from patchwork.views import generic_list, patch_to_mbox
def patch(request, patch_id):
from __future__ import absolute_import
-from patchwork.models import Patch, Project
-from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.models import User
+from django.shortcuts import render_to_response, get_object_or_404
+
+from patchwork.models import Patch, Project
from patchwork.requestcontext import PatchworkRequestContext
def project(request, project_id):
from __future__ import absolute_import
-from django.contrib.auth.decorators import login_required
-from patchwork.requestcontext import PatchworkRequestContext
-from django.shortcuts import render_to_response, get_object_or_404
from django.contrib import auth
+from django.contrib.auth.decorators import login_required
from django.contrib.sites.models import Site
-from django.http import HttpResponseRedirect
-from patchwork.models import Project, Bundle, Person, EmailConfirmation, \
- State, EmailOptout
-from patchwork.forms import UserProfileForm, UserPersonLinkForm, \
- RegistrationForm
-from patchwork.filters import DelegateFilter
-from patchwork.views import generic_list
-from django.template.loader import render_to_string
from django.conf import settings
from django.core.mail import send_mail
import django.core.urlresolvers
+from django.http import HttpResponseRedirect
+from django.shortcuts import render_to_response, get_object_or_404
+from django.template.loader import render_to_string
+
+from patchwork.filters import DelegateFilter
+from patchwork.forms import (UserProfileForm, UserPersonLinkForm,
+ RegistrationForm)
+from patchwork.models import (Project, Bundle, Person, EmailConfirmation,
+ State, EmailOptout)
+from patchwork.requestcontext import PatchworkRequestContext
+from patchwork.views import generic_list
def register(request):
context = PatchworkRequestContext(request)
from __future__ import absolute_import
-from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
-from DocXMLRPCServer import XMLRPCDocGenerator
import base64
+from DocXMLRPCServer import XMLRPCDocGenerator
+from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
import sys
import xmlrpclib