From: Stephen Finucane Date: Tue, 8 Dec 2015 15:09:00 +0000 (+0000) Subject: Use URL names in place of Python paths X-Git-Tag: v1.1.0~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97b7b45a94ba7420f105938179b2a8a114bee040;p=thirdparty%2Fpatchwork.git Use URL names in place of Python paths Reversing by Python paths has been deprecated in Django 1.8, causes warnings in Django 1.9 and will be removed in Django 2.0. Resolve the warnings and prevent issues in the future by referring to URLs by name, rather than by Python path. https://docs.djangoproject.com/en/1.9/releases/1.8/#passing-a-dotted-path-to-reverse-and-url Signed-off-by: Stephen Finucane --- diff --git a/patchwork/models.py b/patchwork/models.py index be25fbc2..b112a36c 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -428,7 +428,7 @@ class Patch(models.Model): @models.permalink def get_absolute_url(self): - return ('patchwork.views.patch.patch', (), {'patch_id': self.id}) + return ('patch-detail', (), {'patch_id': self.id}) def __str__(self): return self.name @@ -504,7 +504,7 @@ class Bundle(models.Model): return None site = Site.objects.get_current() return 'http://%s%s' % (site.domain, - reverse('patchwork.views.bundle.bundle', + reverse('bundle-detail', kwargs={ 'username': self.owner.username, 'bundlename': self.name @@ -512,7 +512,7 @@ class Bundle(models.Model): @models.permalink def get_absolute_url(self): - return ('patchwork.views.bundle.bundle', (), { + return ('bundle-detail', (), { 'username': self.owner.username, 'bundlename': self.name, }) diff --git a/patchwork/templates/patchwork/activation_email.txt b/patchwork/templates/patchwork/activation_email.txt index caf514a5..34e2fce0 100644 --- a/patchwork/templates/patchwork/activation_email.txt +++ b/patchwork/templates/patchwork/activation_email.txt @@ -3,7 +3,7 @@ Hi, This email is to confirm your account on the patchwork patch-tracking system. You can activate your account by visiting the url: - http://{{site.domain}}{% url 'patchwork.views.confirm' key=confirmation.key %} + http://{{site.domain}}{% url 'confirm' key=confirmation.key %} If you didn't request a user account on patchwork, then you can ignore this mail. diff --git a/patchwork/templates/patchwork/bundle.html b/patchwork/templates/patchwork/bundle.html index d71132d3..aa46e94d 100644 --- a/patchwork/templates/patchwork/bundle.html +++ b/patchwork/templates/patchwork/bundle.html @@ -16,7 +16,7 @@

This bundle contains patches for the {{ bundle.project.linkname }} project.

-

Download bundle as mbox

+

Download bundle as mbox

{% if bundleform %}
diff --git a/patchwork/templates/patchwork/bundles.html b/patchwork/templates/patchwork/bundles.html index 11fb89dc..029379d8 100644 --- a/patchwork/templates/patchwork/bundles.html +++ b/patchwork/templates/patchwork/bundles.html @@ -28,7 +28,7 @@ {{ bundle.n_patches }} download diff --git a/patchwork/templates/patchwork/filters.html b/patchwork/templates/patchwork/filters.html index acb9375e..3abfe249 100644 --- a/patchwork/templates/patchwork/filters.html +++ b/patchwork/templates/patchwork/filters.html @@ -70,7 +70,7 @@ $(document).ready(function() { return callback(); req = $.ajax({ - url: '{% url 'patchwork.views.api.submitters' %}?q=' + + url: '{% url 'api-submitters' %}?q=' + encodeURIComponent(query) + '&l=10', error: function() { callback(); diff --git a/patchwork/templates/patchwork/help/pwclient.html b/patchwork/templates/patchwork/help/pwclient.html index 793cf737..e3fbc82e 100644 --- a/patchwork/templates/patchwork/help/pwclient.html +++ b/patchwork/templates/patchwork/help/pwclient.html @@ -11,13 +11,13 @@ and applying patches.

To use pwclient, you will need:

    -
  • The pwclient +
  • The pwclient program (11kB, python script)
  • (optional) a .pwclientrc file in your home directory.

You can create your own .pwclientrc file. Each -patchwork project +patchwork project provides a sample linked from the 'project info' page.

{% endblock %} diff --git a/patchwork/templates/patchwork/login.html b/patchwork/templates/patchwork/login.html index a28cd31b..293ada3e 100644 --- a/patchwork/templates/patchwork/login.html +++ b/patchwork/templates/patchwork/login.html @@ -29,7 +29,7 @@ - + Forgot password? diff --git a/patchwork/templates/patchwork/mail-settings.html b/patchwork/templates/patchwork/mail-settings.html index 440af087..ab0af4f9 100644 --- a/patchwork/templates/patchwork/mail-settings.html +++ b/patchwork/templates/patchwork/mail-settings.html @@ -13,18 +13,18 @@ Patchwork may not send automated notifications to this address. - + {% csrf_token %}
- + {% else %} Patchwork may send automated notifications to this address. -
+ {% csrf_token %} diff --git a/patchwork/templates/patchwork/optin-request.html b/patchwork/templates/patchwork/optin-request.html index 3dfb1bd8..ba716148 100644 --- a/patchwork/templates/patchwork/optin-request.html +++ b/patchwork/templates/patchwork/optin-request.html @@ -43,7 +43,7 @@ without your consent.

{% endif %} {% if user.is_authenticated %} -

Return to your user +

Return to your user profile.

{% endif %} diff --git a/patchwork/templates/patchwork/optin-request.mail b/patchwork/templates/patchwork/optin-request.mail index d97c78b1..fb4814bf 100644 --- a/patchwork/templates/patchwork/optin-request.mail +++ b/patchwork/templates/patchwork/optin-request.mail @@ -5,7 +5,7 @@ email from the patchwork system at {{site.domain}}. To complete the opt-in process, visit: - http://{{site.domain}}{% url 'patchwork.views.confirm' key=confirmation.key %} + http://{{site.domain}}{% url 'confirm' key=confirmation.key %} If you didn't request this opt-in, you don't need to do anything. diff --git a/patchwork/templates/patchwork/optin.html b/patchwork/templates/patchwork/optin.html index 01aaa0e2..90561910 100644 --- a/patchwork/templates/patchwork/optin.html +++ b/patchwork/templates/patchwork/optin.html @@ -9,11 +9,11 @@ automated email from this patchwork system, using the address {{email}}.

If you later decide that you no longer want to receive automated mail from -patchwork, just visit http://{{site.domain}}{% url 'patchwork.views.mail.settings' %}, or +patchwork, just visit http://{{site.domain}}{% url 'mail-settings' %}, or visit the main patchwork page and navigate from there.

{% if user.is_authenticated %} -

Return to your user +

Return to your user profile.

{% endif %} {% endblock %} diff --git a/patchwork/templates/patchwork/optout-request.html b/patchwork/templates/patchwork/optout-request.html index 092dbbbf..c043dc77 100644 --- a/patchwork/templates/patchwork/optout-request.html +++ b/patchwork/templates/patchwork/optout-request.html @@ -44,7 +44,7 @@ without your consent.

{% endif %} {% if user.is_authenticated %} -

Return to your user +

Return to your user profile.

{% endif %} diff --git a/patchwork/templates/patchwork/optout-request.mail b/patchwork/templates/patchwork/optout-request.mail index 67203caa..8a3e46fd 100644 --- a/patchwork/templates/patchwork/optout-request.mail +++ b/patchwork/templates/patchwork/optout-request.mail @@ -5,7 +5,7 @@ from the patchwork system at {{site.domain}}. To complete the opt-out process, visit: - http://{{site.domain}}{% url 'patchwork.views.confirm' key=confirmation.key %} + http://{{site.domain}}{% url 'confirm' key=confirmation.key %} If you didn't request this opt-out, you don't need to do anything. diff --git a/patchwork/templates/patchwork/optout.html b/patchwork/templates/patchwork/optout.html index b140bf49..6a325039 100644 --- a/patchwork/templates/patchwork/optout.html +++ b/patchwork/templates/patchwork/optout.html @@ -12,11 +12,11 @@ automated notifications from this patchwork system, from the address different sites, as they are run independently. You may need to opt-out of those separately.

If you later decide to receive mail from patchwork, just visit -http://{{site.domain}}{% url 'patchwork.views.mail.settings' %}, or +http://{{site.domain}}{% url 'mail-settings' %}, or visit the main patchwork page and navigate from there.

{% if user.is_authenticated %} -

Return to your user +

Return to your user profile.

{% endif %} {% endblock %} diff --git a/patchwork/templates/patchwork/patch-change-notification.mail b/patchwork/templates/patchwork/patch-change-notification.mail index 4246704b..0047fdbe 100644 --- a/patchwork/templates/patchwork/patch-change-notification.mail +++ b/patchwork/templates/patchwork/patch-change-notification.mail @@ -17,4 +17,4 @@ Happy patchworking. This is an automated mail sent by the patchwork system at {{site.domain}}. To stop receiving these notifications, edit your mail settings at: - http://{{site.domain}}{% url 'patchwork.views.mail.settings' %} + http://{{site.domain}}{% url 'mail-settings' %} diff --git a/patchwork/templates/patchwork/patch-list.html b/patchwork/templates/patchwork/patch-list.html index 165b0794..bcbb3b92 100644 --- a/patchwork/templates/patchwork/patch-list.html +++ b/patchwork/templates/patchwork/patch-list.html @@ -155,7 +155,7 @@ $(document).ready(function() { {% endif %} - {{ patch.name|default:"[no subject]"|truncatechars:100 }} {{ patch|patch_tags }} {{ patch|patch_checks }} diff --git a/patchwork/templates/patchwork/patch.html b/patchwork/templates/patchwork/patch.html index 37a3bebc..f3793179 100644 --- a/patchwork/templates/patchwork/patch.html +++ b/patchwork/templates/patchwork/patch.html @@ -7,7 +7,7 @@ {% block title %}{{patch.name}}{% endblock %} {% block breadcrumb %} -{{ project.linkname }} patches → {{ patch.name }} @@ -216,11 +216,11 @@ function toggle_headers(link_id, headers_id) hide {% if patch.content %} | - download patch {% endif %} | - download mbox
diff --git a/patchwork/templates/patchwork/profile.html b/patchwork/templates/patchwork/profile.html index 116d6d63..04fe12ed 100644 --- a/patchwork/templates/patchwork/profile.html +++ b/patchwork/templates/patchwork/profile.html @@ -10,14 +10,14 @@ {% if user.profile.maintainer_projects.count %} Maintainer of {% for project in user.profile.maintainer_projects.all %} -{{ project.linkname }}{% if not forloop.last %},{% endif %}{% endfor %}. {% endif %} {% if user.profile.contributor_projects.count %} Contributor to {% for project in user.profile.contributor_projects.all %} -{{ project.linkname }}{% if not forloop.last %},{% endif %}{% endfor %}. {% endif %}

@@ -26,7 +26,7 @@ Contributor to

Todo

{% if user.profile.n_todo_patches %} -

Your todo +

Your todo list contains {{ user.profile.n_todo_patches }} patch{{ user.profile.n_todo_patches|pluralize:"es" }}.

{% else %} @@ -56,7 +56,7 @@ address.

{{ email.email }} {% ifnotequal user.email email.email %} - {% csrf_token %} @@ -65,14 +65,14 @@ address.

{% if email.is_optout %} - + No, {% csrf_token %} {% else %} -
+ Yes, {% csrf_token %} @@ -84,7 +84,7 @@ address.

{% endfor %} - + {% csrf_token %} {{ linkform.email }} @@ -107,7 +107,7 @@ address.

  • {{ bundle.name }}
  • {% endfor %} -

    Visit the bundles +

    Visit the bundles page to manage your bundles.

    {% else %}

    You have no bundles.

    @@ -134,7 +134,7 @@ address.

    Authentication

    -Change password +Change password
    diff --git a/patchwork/templates/patchwork/project.html b/patchwork/templates/patchwork/project.html index e1cf3f5f..eeb83ad3 100644 --- a/patchwork/templates/patchwork/project.html +++ b/patchwork/templates/patchwork/project.html @@ -49,9 +49,9 @@ {% if settings.ENABLE_XMLRPC %} -

    Sample patchwork +

    Sample patchwork client configuration for this project: .pwclientrc.

    {% endif %} diff --git a/patchwork/templates/patchwork/projects.html b/patchwork/templates/patchwork/projects.html index 8c727ad1..543a1d43 100644 --- a/patchwork/templates/patchwork/projects.html +++ b/patchwork/templates/patchwork/projects.html @@ -10,7 +10,7 @@ {% for p in projects %}

    - {{p.linkname}}

    {{p.name}}
    diff --git a/patchwork/templates/patchwork/pwclientrc b/patchwork/templates/patchwork/pwclientrc index d331003a..96464c1b 100644 --- a/patchwork/templates/patchwork/pwclientrc +++ b/patchwork/templates/patchwork/pwclientrc @@ -8,7 +8,7 @@ # default={{ project.linkname }} [{{ project.linkname }}] -url= {{scheme}}://{{site.domain}}{% url 'patchwork.views.xmlrpc.xmlrpc' %} +url= {{scheme}}://{{site.domain}}{% url 'xmlrpc' %} {% if user.is_authenticated %} username: {{ user.username }} password: diff --git a/patchwork/templates/patchwork/registration-confirm.html b/patchwork/templates/patchwork/registration-confirm.html index 61114014..d40c3050 100644 --- a/patchwork/templates/patchwork/registration-confirm.html +++ b/patchwork/templates/patchwork/registration-confirm.html @@ -7,7 +7,7 @@

    Registraton confirmed!

    Your patchwork registration is complete. Head over to your profile to start using + href="{% url 'user-profile' %}">profile to start using patchwork's extra features.

    {% endblock %} diff --git a/patchwork/templates/patchwork/todo-lists.html b/patchwork/templates/patchwork/todo-lists.html index e268160b..6365f59a 100644 --- a/patchwork/templates/patchwork/todo-lists.html +++ b/patchwork/templates/patchwork/todo-lists.html @@ -16,7 +16,7 @@ {% for todo_list in todo_lists %} {{ todo_list.project.name }} {{ todo_list.n_patches }} diff --git a/patchwork/templates/patchwork/user-link-confirm.html b/patchwork/templates/patchwork/user-link-confirm.html index 449bfebb..051a13c1 100644 --- a/patchwork/templates/patchwork/user-link-confirm.html +++ b/patchwork/templates/patchwork/user-link-confirm.html @@ -13,7 +13,7 @@ your patchwork account

    {% endif %} -

    Back to your +

    Back to your profile.

    {% endblock %} diff --git a/patchwork/templates/patchwork/user-link.html b/patchwork/templates/patchwork/user-link.html index e436c3a3..bf30cec8 100644 --- a/patchwork/templates/patchwork/user-link.html +++ b/patchwork/templates/patchwork/user-link.html @@ -21,7 +21,7 @@ you.

    • {{error}}
    {% endif %} - + {% csrf_token %} {{linkform.email.errors}} Link an email address: {{ linkform.email }} diff --git a/patchwork/templates/patchwork/user-link.mail b/patchwork/templates/patchwork/user-link.mail index 8db67264..ac4d5400 100644 --- a/patchwork/templates/patchwork/user-link.mail +++ b/patchwork/templates/patchwork/user-link.mail @@ -7,6 +7,6 @@ This email is to confirm that you own the email address: So that you can add it to your patchwork profile. You can confirm this email address by visiting the url: - http://{{site.domain}}{% url 'patchwork.views.confirm' key=confirmation.key %} + http://{{site.domain}}{% url 'confirm' key=confirmation.key %} Happy patchworking. diff --git a/patchwork/templatetags/person.py b/patchwork/templatetags/person.py index d35203b5..7af021f0 100644 --- a/patchwork/templatetags/person.py +++ b/patchwork/templatetags/person.py @@ -38,7 +38,7 @@ def personify(person, project): else: linktext = escape(person.email) - url = reverse('patchwork.views.patch.list', + url = reverse('patch-list', kwargs={'project_id': project.linkname}) str = '%s' % ( url, SubmitterFilter.param, escape(person.id), linktext) diff --git a/patchwork/tests/test_confirm.py b/patchwork/tests/test_confirm.py index 7ef922e0..5c5c69e5 100644 --- a/patchwork/tests/test_confirm.py +++ b/patchwork/tests/test_confirm.py @@ -25,8 +25,7 @@ from patchwork.models import EmailConfirmation, Person def _confirmation_url(conf): - return reverse('patchwork.views.confirm', - kwargs={'key': conf.key}) + return reverse('confirm', kwargs={'key': conf.key}) class TestUser(object): diff --git a/patchwork/tests/test_list.py b/patchwork/tests/test_list.py index 88628580..0cc33fcf 100644 --- a/patchwork/tests/test_list.py +++ b/patchwork/tests/test_list.py @@ -37,8 +37,7 @@ class EmptyPatchListTest(TestCase): patches present""" project = defaults.project defaults.project.save() - url = reverse('patchwork.views.patch.list', - kwargs={'project_id': project.linkname}) + url = reverse('patch-list', kwargs={'project_id': project.linkname}) response = self.client.get(url) self.assertContains(response, 'No patches to display') self.assertNotContains(response, 'tbody') @@ -96,7 +95,7 @@ class PatchOrderTest(TestCase): [test_fn(p1, p2) for (p1, p2) in pairs] def testDateOrder(self): - url = reverse('patchwork.views.patch.list', + url = reverse('patch-list', kwargs={'project_id': defaults.project.linkname}) response = self.client.get(url + '?order=date') @@ -105,7 +104,7 @@ class PatchOrderTest(TestCase): self._test_sequence(response, test_fn) def testDateReverseOrder(self): - url = reverse('patchwork.views.patch.list', + url = reverse('patch-list', kwargs={'project_id': defaults.project.linkname}) response = self.client.get(url + '?order=-date') @@ -114,7 +113,7 @@ class PatchOrderTest(TestCase): self._test_sequence(response, test_fn) def testSubmitterOrder(self): - url = reverse('patchwork.views.patch.list', + url = reverse('patch-list', kwargs={'project_id': defaults.project.linkname}) response = self.client.get(url + '?order=submitter') @@ -124,7 +123,7 @@ class PatchOrderTest(TestCase): self._test_sequence(response, test_fn) def testSubmitterReverseOrder(self): - url = reverse('patchwork.views.patch.list', + url = reverse('patch-list', kwargs={'project_id': defaults.project.linkname}) response = self.client.get(url + '?order=-submitter') diff --git a/patchwork/tests/test_mail_settings.py b/patchwork/tests/test_mail_settings.py index 02205aa4..954e3e8a 100644 --- a/patchwork/tests/test_mail_settings.py +++ b/patchwork/tests/test_mail_settings.py @@ -30,7 +30,7 @@ from patchwork.tests.utils import create_user, error_strings class MailSettingsTest(TestCase): def setUp(self): - self.url = reverse('patchwork.views.mail.settings') + self.url = reverse('mail-settings') def testMailSettingsGET(self): response = self.client.get(self.url) @@ -64,7 +64,7 @@ class MailSettingsTest(TestCase): self.assertTemplateUsed(response, 'patchwork/mail-settings.html') self.assertEqual(response.context['is_optout'], False) self.assertContains(response, 'may') - optout_url = reverse('patchwork.views.mail.optout') + optout_url = reverse('mail-optout') self.assertContains(response, ('action="%s"' % optout_url)) def testMailSettingsPOSTOptedOut(self): @@ -75,19 +75,19 @@ class MailSettingsTest(TestCase): self.assertTemplateUsed(response, 'patchwork/mail-settings.html') self.assertEqual(response.context['is_optout'], True) self.assertContains(response, 'may not') - optin_url = reverse('patchwork.views.mail.optin') + optin_url = reverse('mail-optin') self.assertContains(response, ('action="%s"' % optin_url)) class OptoutRequestTest(TestCase): def setUp(self): - self.url = reverse('patchwork.views.mail.optout') + self.url = reverse('mail-optout') def testOptOutRequestGET(self): response = self.client.get(self.url) self.assertRedirects( - response, reverse('patchwork.views.mail.settings')) + response, reverse('mail-settings')) def testOptoutRequestValidPOST(self): email = u'foo@example.com' @@ -103,7 +103,7 @@ class OptoutRequestTest(TestCase): self.assertContains(response, email) # check email - url = reverse('patchwork.views.confirm', kwargs={'key': conf.key}) + url = reverse('confirm', kwargs={'key': conf.key}) self.assertEqual(len(mail.outbox), 1) msg = mail.outbox[0] self.assertEqual(msg.to, [email]) @@ -131,14 +131,13 @@ class OptoutRequestTest(TestCase): class OptoutTest(TestCase): def setUp(self): - self.url = reverse('patchwork.views.mail.optout') + self.url = reverse('mail-optout') self.email = u'foo@example.com' self.conf = EmailConfirmation(type='optout', email=self.email) self.conf.save() def testOptoutValidHash(self): - url = reverse('patchwork.views.confirm', - kwargs={'key': self.conf.key}) + url = reverse('confirm', kwargs={'key': self.conf.key}) response = self.client.get(url) self.assertEqual(response.status_code, 200) @@ -166,14 +165,13 @@ class OptoutPreexistingTest(OptoutTest): class OptinRequestTest(TestCase): def setUp(self): - self.url = reverse('patchwork.views.mail.optin') + self.url = reverse('mail-optin') self.email = u'foo@example.com' EmailOptout(email=self.email).save() def testOptInRequestGET(self): response = self.client.get(self.url) - self.assertRedirects( - response, reverse('patchwork.views.mail.settings')) + self.assertRedirects(response, reverse('mail-settings')) def testOptInRequestValidPOST(self): response = self.client.post(self.url, {'email': self.email}) @@ -188,8 +186,7 @@ class OptinRequestTest(TestCase): self.assertContains(response, self.email) # check email - url = reverse('patchwork.views.confirm', - kwargs={'key': conf.key}) + url = reverse('confirm', kwargs={'key': conf.key}) self.assertEqual(len(mail.outbox), 1) msg = mail.outbox[0] self.assertEqual(msg.to, [self.email]) @@ -224,8 +221,7 @@ class OptinTest(TestCase): self.conf.save() def testOptinValidHash(self): - url = reverse('patchwork.views.confirm', - kwargs={'key': self.conf.key}) + url = reverse('confirm', kwargs={'key': self.conf.key}) response = self.client.get(url) self.assertEqual(response.status_code, 200) @@ -245,7 +241,7 @@ class OptinWithoutOptoutTest(TestCase): """Test an opt-in with no existing opt-out""" def setUp(self): - self.url = reverse('patchwork.views.mail.optin') + self.url = reverse('mail-optin') def testOptInWithoutOptout(self): email = u'foo@example.com' @@ -263,9 +259,9 @@ class UserProfileOptoutFormTest(TestCase): page, for logged-in users""" def setUp(self): - self.url = reverse('patchwork.views.user.profile') - self.optout_url = reverse('patchwork.views.mail.optout') - self.optin_url = reverse('patchwork.views.mail.optin') + self.url = reverse('user-profile') + self.optout_url = reverse('mail-optout') + self.optin_url = reverse('mail-optin') self.form_re_template = (']*action="%(url)s"[^>]*>' '.*?]*value="%(email)s"[^>]*>.*?' '') diff --git a/patchwork/tests/test_registration.py b/patchwork/tests/test_registration.py index b5f5bb44..998dd6fd 100644 --- a/patchwork/tests/test_registration.py +++ b/patchwork/tests/test_registration.py @@ -28,8 +28,7 @@ from patchwork.tests.utils import create_user def _confirmation_url(conf): - return reverse('patchwork.views.confirm', - kwargs={'key': conf.key}) + return reverse('confirm', kwargs={'key': conf.key}) class TestUser(object): diff --git a/patchwork/tests/test_updates.py b/patchwork/tests/test_updates.py index a8d9749b..d40a0a2b 100644 --- a/patchwork/tests/test_updates.py +++ b/patchwork/tests/test_updates.py @@ -33,8 +33,7 @@ class MultipleUpdateTest(TestCase): self.client.login(username=self.user.username, password=self.user.username) self.properties_form_id = 'patchform-properties' - self.url = reverse( - 'patchwork.views.patch.list', args=[defaults.project.linkname]) + self.url = reverse('patch-list', args=[defaults.project.linkname]) self.base_data = { 'action': 'Update', 'project': str(defaults.project.id), 'form': 'patchlistform', 'archived': '*', 'delegate': '*', diff --git a/patchwork/tests/test_user.py b/patchwork/tests/test_user.py index 3df5ffa5..c27328e1 100644 --- a/patchwork/tests/test_user.py +++ b/patchwork/tests/test_user.py @@ -28,8 +28,7 @@ from patchwork.tests.utils import defaults, error_strings def _confirmation_url(conf): - return reverse('patchwork.views.confirm', - kwargs={'key': conf.key}) + return reverse('confirm', kwargs={'key': conf.key}) class TestUser(object): @@ -188,9 +187,8 @@ class UserPasswordChangeTest(TestCase): user = None def setUp(self): - self.form_url = reverse('django.contrib.auth.views.password_change') - self.done_url = reverse( - 'django.contrib.auth.views.password_change_done') + self.form_url = reverse('password_change') + self.done_url = reverse('password_change_done') def testPasswordChangeForm(self): self.user = TestUser() diff --git a/patchwork/tests/test_xmlrpc.py b/patchwork/tests/test_xmlrpc.py index d8e1d98c..e70ed30a 100644 --- a/patchwork/tests/test_xmlrpc.py +++ b/patchwork/tests/test_xmlrpc.py @@ -35,15 +35,13 @@ class XMLRPCTest(LiveServerTestCase): fixtures = ['default_states'] def setUp(self): - self.url = (self.live_server_url + - reverse('patchwork.views.xmlrpc.xmlrpc')) + self.url = (self.live_server_url + reverse('xmlrpc')) self.rpc = xmlrpc_client.Server(self.url) def testGetRedirect(self): response = self.client.patch(self.url) self.assertRedirects(response, - reverse('patchwork.views.help.help', - kwargs={'path': 'pwclient/'})) + reverse('help', kwargs={'path': 'pwclient/'})) def testList(self): defaults.project.save() diff --git a/patchwork/views/bundle.py b/patchwork/views/bundle.py index c180cde5..9b88be9b 100644 --- a/patchwork/views/bundle.py +++ b/patchwork/views/bundle.py @@ -96,14 +96,13 @@ def setbundle(request): if bundle: return HttpResponseRedirect( django.core.urlresolvers.reverse( - 'patchwork.views.bundle.bundle', + 'bundle-detail', kwargs={'bundle_id': bundle.id} ) ) else: return HttpResponseRedirect( - django.core.urlresolvers.reverse( - 'patchwork.views.bundle.list') + django.core.urlresolvers.reverse('bundle-list') ) @@ -147,8 +146,7 @@ def bundle(request, username, bundlename): if action == 'delete': bundle.delete() return HttpResponseRedirect( - django.core.urlresolvers.reverse( - 'patchwork.views.user.profile') + django.core.urlresolvers.reverse('user-profile') ) elif action == 'update': form = BundleForm(request.POST, instance=bundle) @@ -183,7 +181,7 @@ def bundle(request, username, bundlename): form = None context = generic_list(request, bundle.project, - 'patchwork.views.bundle.bundle', + 'bundle-detail', view_args={'username': bundle.owner.username, 'bundlename': bundle.name}, filter_settings=filter_settings, @@ -224,7 +222,7 @@ def bundle_redir(request, bundle_id): def mbox_redir(request, bundle_id): bundle = get_object_or_404(Bundle, id=bundle_id, owner=request.user) return HttpResponseRedirect(django.core.urlresolvers.reverse( - 'patchwork.views.bundle.mbox', kwargs={ + 'bundle-mbox', kwargs={ 'username': request.user.username, 'bundlename': bundle.name, })) diff --git a/patchwork/views/patch.py b/patchwork/views/patch.py index f91b6273..e739c908 100644 --- a/patchwork/views/patch.py +++ b/patchwork/views/patch.py @@ -112,6 +112,6 @@ def mbox(request, patch_id): def list(request, project_id): project = get_object_or_404(Project, linkname=project_id) - context = generic_list(request, project, 'patchwork.views.patch.list', + context = generic_list(request, project, 'patch-list', view_args={'project_id': project.linkname}) return render_to_response('patchwork/list.html', context) diff --git a/patchwork/views/project.py b/patchwork/views/project.py index e3f37471..5bc34e9b 100644 --- a/patchwork/views/project.py +++ b/patchwork/views/project.py @@ -34,7 +34,7 @@ def list(request): if projects.count() == 1: return HttpResponseRedirect( - urlresolvers.reverse('patchwork.views.patch.list', + urlresolvers.reverse('patch-list', kwargs={'project_id': projects[0].linkname})) context['projects'] = projects diff --git a/patchwork/views/user.py b/patchwork/views/user.py index 529a3bd3..d6e57974 100644 --- a/patchwork/views/user.py +++ b/patchwork/views/user.py @@ -184,7 +184,7 @@ def unlink(request, person_id): person.user = None person.save() - url = django.core.urlresolvers.reverse('patchwork.views.user.profile') + url = django.core.urlresolvers.reverse('user-profile') return HttpResponseRedirect(url) diff --git a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py index d928400c..28fd03bd 100644 --- a/patchwork/views/xmlrpc.py +++ b/patchwork/views/xmlrpc.py @@ -136,7 +136,7 @@ dispatcher = PatchworkXMLRPCDispatcher() @csrf_exempt def xmlrpc(request): if request.method not in ['POST', 'GET']: - return HttpResponseRedirect(reverse('patchwork.views.help.help', + return HttpResponseRedirect(reverse('help', kwargs={'path': 'pwclient/'})) response = HttpResponse() diff --git a/templates/base.html b/templates/base.html index b6f7056e..dec904ba 100644 --- a/templates/base.html +++ b/templates/base.html @@ -34,21 +34,21 @@ Patchwork + href="{% url 'project-list' %}">Patchwork {% block heading %}{% endblock %}
    @@ -72,10 +72,10 @@ {% if project %}