diff options
40 files changed, 95 insertions, 109 deletions
diff --git a/patchwork/models.py b/patchwork/models.py index be25fbc..b112a36 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 caf514a..34e2fce 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 d71132d..aa46e94 100644 --- a/patchwork/templates/patchwork/bundle.html +++ b/patchwork/templates/patchwork/bundle.html @@ -16,7 +16,7 @@ <p>This bundle contains patches for the {{ bundle.project.linkname }} project.</p> -<p><a href="{% url 'patchwork.views.bundle.mbox' username=bundle.owner.username bundlename=bundle.name %}">Download bundle as mbox</a></p> +<p><a href="{% url 'bundle-mbox' username=bundle.owner.username bundlename=bundle.name %}">Download bundle as mbox</a></p> {% if bundleform %} <form method="post"> diff --git a/patchwork/templates/patchwork/bundles.html b/patchwork/templates/patchwork/bundles.html index 11fb89d..029379d 100644 --- a/patchwork/templates/patchwork/bundles.html +++ b/patchwork/templates/patchwork/bundles.html @@ -28,7 +28,7 @@ </td> <td style="text-align: right">{{ bundle.n_patches }}</td> <td style="text-align: center;"><a - href="{% url 'patchwork.views.bundle.mbox' username=bundle.owner.username bundlename=bundle.name %}" + href="{% url 'bundle-mbox' username=bundle.owner.username bundlename=bundle.name %}" ><img src="{% static "images/16-em-down.png" %}" width="16" height="16" alt="download" title="download"/></a></td> <td style="text-align: center;"> diff --git a/patchwork/templates/patchwork/filters.html b/patchwork/templates/patchwork/filters.html index acb9375..3abfe24 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 793cf73..e3fbc82 100644 --- a/patchwork/templates/patchwork/help/pwclient.html +++ b/patchwork/templates/patchwork/help/pwclient.html @@ -11,13 +11,13 @@ and applying patches.</p> <p>To use pwclient, you will need:</p> <ul> - <li>The <a href="{% url 'patchwork.views.pwclient.pwclient' %}">pwclient</a> + <li>The <a href="{% url 'pwclient' %}">pwclient</a> program (11kB, python script)</li> <li>(optional) a <code>.pwclientrc</code> file in your home directory.</li> </ul> <p>You can create your own <code>.pwclientrc</code> file. Each -<a href="{% url 'patchwork.views.project.list' %}">patchwork project</a> +<a href="{% url 'project-list' %}">patchwork project</a> provides a sample linked from the 'project info' page.</p> {% endblock %} diff --git a/patchwork/templates/patchwork/login.html b/patchwork/templates/patchwork/login.html index a28cd31..293ada3 100644 --- a/patchwork/templates/patchwork/login.html +++ b/patchwork/templates/patchwork/login.html @@ -29,7 +29,7 @@ <input type="submit" value="Login"/> </td> <td class="submitrow"> - <a href="{% url 'django.contrib.auth.views.password_reset' %}"> + <a href="{% url 'password_reset' %}"> Forgot password? </a> </td> diff --git a/patchwork/templates/patchwork/mail-settings.html b/patchwork/templates/patchwork/mail-settings.html index 440af08..ab0af4f 100644 --- a/patchwork/templates/patchwork/mail-settings.html +++ b/patchwork/templates/patchwork/mail-settings.html @@ -13,18 +13,18 @@ <td>Patchwork <strong>may not</strong> send automated notifications to this address.</td> <td> - <form method="post" action="{% url 'patchwork.views.mail.optin' %}"> + <form method="post" action="{% url 'mail-optin' %}"> {% csrf_token %} <input type="hidden" name="email" value="{{email}}"/> <input type="submit" value="Opt-in"/> </form> </td> - + {% else %} <td>Patchwork <strong>may</strong> send automated notifications to this address.</td> <td> - <form method="post" action="{% url 'patchwork.views.mail.optout' %}"> + <form method="post" action="{% url 'mail-optout' %}"> {% csrf_token %} <input type="hidden" name="email" value="{{email}}"/> <input type="submit" value="Opt-out"/> diff --git a/patchwork/templates/patchwork/optin-request.html b/patchwork/templates/patchwork/optin-request.html index 3dfb1bd..ba71614 100644 --- a/patchwork/templates/patchwork/optin-request.html +++ b/patchwork/templates/patchwork/optin-request.html @@ -43,7 +43,7 @@ without your consent.</p> {% endif %} {% if user.is_authenticated %} -<p>Return to your <a href="{% url 'patchwork.views.user.profile' %}">user +<p>Return to your <a href="{% url 'user-profile' %}">user profile</a>.</p> {% endif %} diff --git a/patchwork/templates/patchwork/optin-request.mail b/patchwork/templates/patchwork/optin-request.mail index d97c78b..fb4814b 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 01aaa0e..9056191 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 <strong>{{email}}</strong>.</p> <p>If you later decide that you no longer want to receive automated mail from -patchwork, just visit <a href="{% url 'patchwork.views.mail.settings' %}" ->http://{{site.domain}}{% url 'patchwork.views.mail.settings' %}</a>, or +patchwork, just visit <a href="{% url 'mail-settings' %}" +>http://{{site.domain}}{% url 'mail-settings' %}</a>, or visit the main patchwork page and navigate from there.</p> {% if user.is_authenticated %} -<p>Return to your <a href="{% url 'patchwork.views.user.profile' %}">user +<p>Return to your <a href="{% url 'user-profile' %}">user profile</a>.</p> {% endif %} {% endblock %} diff --git a/patchwork/templates/patchwork/optout-request.html b/patchwork/templates/patchwork/optout-request.html index 092dbbb..c043dc7 100644 --- a/patchwork/templates/patchwork/optout-request.html +++ b/patchwork/templates/patchwork/optout-request.html @@ -44,7 +44,7 @@ without your consent.</p> {% endif %} {% if user.is_authenticated %} -<p>Return to your <a href="{% url 'patchwork.views.user.profile' %}">user +<p>Return to your <a href="{% url 'user-profile' %}">user profile</a>.</p> {% endif %} diff --git a/patchwork/templates/patchwork/optout-request.mail b/patchwork/templates/patchwork/optout-request.mail index 67203ca..8a3e46f 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 b140bf4..6a32503 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.</p> <p>If you later decide to receive mail from patchwork, just visit -<a href="{% url 'patchwork.views.mail.settings' %}" ->http://{{site.domain}}{% url 'patchwork.views.mail.settings' %}</a>, or +<a href="{% url 'mail-settings' %}" +>http://{{site.domain}}{% url 'mail-settings' %}</a>, or visit the main patchwork page and navigate from there.</p> {% if user.is_authenticated %} -<p>Return to your <a href="{% url 'patchwork.views.user.profile' %}">user +<p>Return to your <a href="{% url 'user-profile' %}">user profile</a>.</p> {% endif %} {% endblock %} diff --git a/patchwork/templates/patchwork/patch-change-notification.mail b/patchwork/templates/patchwork/patch-change-notification.mail index 4246704..0047fdb 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 165b079..bcbb3b9 100644 --- a/patchwork/templates/patchwork/patch-list.html +++ b/patchwork/templates/patchwork/patch-list.html @@ -155,7 +155,7 @@ $(document).ready(function() { <input type="checkbox" name="patch_id:{{patch.id}}"/> </td> {% endif %} - <td><a href="{% url 'patchwork.views.patch.patch' patch_id=patch.id %}" + <td><a href="{% url 'patch-detail' patch_id=patch.id %}" >{{ patch.name|default:"[no subject]"|truncatechars:100 }}</a></td> <td style="white-space: nowrap;">{{ patch|patch_tags }}</td> <td style="white-space: nowrap;">{{ patch|patch_checks }}</td> diff --git a/patchwork/templates/patchwork/patch.html b/patchwork/templates/patchwork/patch.html index 37a3beb..f379317 100644 --- a/patchwork/templates/patchwork/patch.html +++ b/patchwork/templates/patchwork/patch.html @@ -7,7 +7,7 @@ {% block title %}{{patch.name}}{% endblock %} {% block breadcrumb %} -<a href="{% url 'patchwork.views.patch.list' project_id=project.linkname %}" +<a href="{% url 'patch-list' project_id=project.linkname %}" >{{ project.linkname }} patches</a> → {{ patch.name }} @@ -216,11 +216,11 @@ function toggle_headers(link_id, headers_id) <a href="javascript:toggle_headers('hide-patch', 'patch')" id="hide-patch">hide</a></span> {% if patch.content %} <span>|</span> - <a href="{% url 'patchwork.views.patch.content' patch_id=patch.id %}" + <a href="{% url 'patch-raw' patch_id=patch.id %}" >download patch</a> {% endif %} <span>|</span> - <a href="{% url 'patchwork.views.patch.mbox' patch_id=patch.id %}" + <a href="{% url 'patch-mbox' patch_id=patch.id %}" >download mbox</a> </h2> <div id="patch" class="patch"> diff --git a/patchwork/templates/patchwork/profile.html b/patchwork/templates/patchwork/profile.html index 116d6d6..04fe12e 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 %} -<a href="{% url 'patchwork.views.patch.list' project_id=project.linkname %}" +<a href="{% url 'patch-list' project_id=project.linkname %}" >{{ project.linkname }}</a>{% if not forloop.last %},{% endif %}{% endfor %}. {% endif %} {% if user.profile.contributor_projects.count %} Contributor to {% for project in user.profile.contributor_projects.all %} -<a href="{% url 'patchwork.views.patch.list' project_id=project.linkname %}" +<a href="{% url 'patch-list' project_id=project.linkname %}" >{{ project.linkname }}</a>{% if not forloop.last %},{% endif %}{% endfor %}. {% endif %} </p> @@ -26,7 +26,7 @@ Contributor to <div class="box"> <h2>Todo</h2> {% if user.profile.n_todo_patches %} - <p>Your <a href="{% url 'patchwork.views.user.todo_lists' %}">todo + <p>Your <a href="{% url 'user-todo' %}">todo list</a> contains {{ user.profile.n_todo_patches }} patch{{ user.profile.n_todo_patches|pluralize:"es" }}.</p> {% else %} @@ -56,7 +56,7 @@ address.</p> <td>{{ email.email }}</td> <td> {% ifnotequal user.email email.email %} - <form action="{% url 'patchwork.views.user.unlink' person_id=email.id %}" + <form action="{% url 'user-unlink' person_id=email.id %}" method="post"> {% csrf_token %} <input type="submit" value="Unlink"/> @@ -65,14 +65,14 @@ address.</p> </td> <td> {% if email.is_optout %} - <form method="post" action="{% url 'patchwork.views.mail.optin' %}"> + <form method="post" action="{% url 'mail-optin' %}"> No, {% csrf_token %} <input type="hidden" name="email" value="{{email.email}}"/> <input type="submit" value="Opt-in"/> </form> {% else %} - <form method="post" action="{% url 'patchwork.views.mail.optout' %}"> + <form method="post" action="{% url 'mail-optout' %}"> Yes, {% csrf_token %} <input type="hidden" name="email" value="{{email.email}}"/> @@ -84,7 +84,7 @@ address.</p> {% endfor %} <tr> <td colspan="3"> - <form action="{% url 'patchwork.views.user.link' %}" method="post"> + <form action="{% url 'user-link' %}" method="post"> {% csrf_token %} {{ linkform.email }} <input type="submit" value="Add"/> @@ -107,7 +107,7 @@ address.</p> <li><a href="{{ bundle.get_absolute_url }}">{{ bundle.name }}</a></li> {% endfor %} </ul> -<p>Visit the <a href="{%url 'patchwork.views.bundle.bundles' %}">bundles +<p>Visit the <a href="{%url 'bundle-list' %}">bundles page</a> to manage your bundles.</p> {% else %} <p>You have no bundles.</p> @@ -134,7 +134,7 @@ address.</p> <div class="box"> <h2>Authentication</h2> -<a href="{% url 'django.contrib.auth.views.password_change' %}">Change password</a> +<a href="{% url 'password_change' %}">Change password</a> </div> </div> diff --git a/patchwork/templates/patchwork/project.html b/patchwork/templates/patchwork/project.html index e1cf3f5..eeb83ad 100644 --- a/patchwork/templates/patchwork/project.html +++ b/patchwork/templates/patchwork/project.html @@ -49,9 +49,9 @@ </table> {% if settings.ENABLE_XMLRPC %} -<p>Sample <a href="{% url 'patchwork.views.help.help' "pwclient/" %}">patchwork +<p>Sample <a href="{% url 'help' "pwclient/" %}">patchwork client</a> configuration for this project: <a -href="{% url 'patchwork.views.pwclient.pwclientrc' project.linkname %}" +href="{% url 'pwclientrc' project.linkname %}" >.pwclientrc</a>.</p> {% endif %} diff --git a/patchwork/templates/patchwork/projects.html b/patchwork/templates/patchwork/projects.html index 8c727ad..543a1d4 100644 --- a/patchwork/templates/patchwork/projects.html +++ b/patchwork/templates/patchwork/projects.html @@ -10,7 +10,7 @@ {% for p in projects %} <div class="project"> <h2 class="project-title"> - <a href="{% url 'patchwork.views.patch.list' project_id=p.linkname %}" + <a href="{% url 'patch-list' project_id=p.linkname %}" >{{p.linkname}}</a> </h2> <div class="project-name">{{p.name}}</div> diff --git a/patchwork/templates/patchwork/pwclientrc b/patchwork/templates/patchwork/pwclientrc index d331003..96464c1 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: <add your patchwork password here> diff --git a/patchwork/templates/patchwork/registration-confirm.html b/patchwork/templates/patchwork/registration-confirm.html index 6111401..d40c305 100644 --- a/patchwork/templates/patchwork/registration-confirm.html +++ b/patchwork/templates/patchwork/registration-confirm.html @@ -7,7 +7,7 @@ <p>Registraton confirmed!</p> <p>Your patchwork registration is complete. Head over to your <a - href="{% url 'patchwork.views.user.profile' %}">profile</a> to start using + href="{% url 'user-profile' %}">profile</a> to start using patchwork's extra features.</p> {% endblock %} diff --git a/patchwork/templates/patchwork/todo-lists.html b/patchwork/templates/patchwork/todo-lists.html index e268160..6365f59 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 %} <tr> <td><a - href="{% url 'patchwork.views.user.todo_list' project_id=todo_list.project.linkname %}" + href="{% url 'user-todo-project' project_id=todo_list.project.linkname %}" >{{ todo_list.project.name }}</a></td> <td class="numberformat">{{ todo_list.n_patches }}</td> </tr> diff --git a/patchwork/templates/patchwork/user-link-confirm.html b/patchwork/templates/patchwork/user-link-confirm.html index 449bfeb..051a13c 100644 --- a/patchwork/templates/patchwork/user-link-confirm.html +++ b/patchwork/templates/patchwork/user-link-confirm.html @@ -13,7 +13,7 @@ your patchwork account</p> {% endif %} -<p>Back to <a href="{% url 'patchwork.views.user.profile' %}">your +<p>Back to <a href="{% url 'user-profile' %}">your profile</a>.</p> {% endblock %} diff --git a/patchwork/templates/patchwork/user-link.html b/patchwork/templates/patchwork/user-link.html index e436c3a..bf30cec 100644 --- a/patchwork/templates/patchwork/user-link.html +++ b/patchwork/templates/patchwork/user-link.html @@ -21,7 +21,7 @@ you.</p> <ul class="errorlist"><li>{{error}}</li></ul> {% endif %} - <form action="{% url 'patchwork.views.user.link' %}" method="post"> + <form action="{% url 'user-link' %}" method="post"> {% 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 8db6726..ac4d540 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 d35203b..7af021f 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 = '<a href="%s?%s=%s">%s</a>' % ( url, SubmitterFilter.param, escape(person.id), linktext) diff --git a/patchwork/tests/test_confirm.py b/patchwork/tests/test_confirm.py index 7ef922e..5c5c69e 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 8862858..0cc33fc 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 02205aa..954e3e8 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, '<strong>may</strong>') - 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, '<strong>may not</strong>') - 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 = ('<form\s+[^>]*action="%(url)s"[^>]*>' '.*?<input\s+[^>]*value="%(email)s"[^>]*>.*?' '</form>') diff --git a/patchwork/tests/test_registration.py b/patchwork/tests/test_registration.py index b5f5bb4..998dd6f 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 a8d9749..d40a0a2 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 3df5ffa..c27328e 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 d8e1d98..e70ed30 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 c180cde..9b88be9 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 f91b627..e739c90 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 e3f3747..5bc34e9 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 529a3bd..d6e5797 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 d928400..28fd03b 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 b6f7056..dec904b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -34,21 +34,21 @@ <span class="icon-bar"></span> </button> <span class="navbar-brand"><a - href="{% url 'patchwork.views.project.list' %}">Patchwork</a> + href="{% url 'project-list' %}">Patchwork</a> {% block heading %}{% endblock %}</span> </div> <div class="collapse navbar-collapse" id="navbar-collapse"> <ul class="nav navbar-nav navbar-right"> {% if project %} - <li><a href="{% url 'patchwork.views.project.project' project_id=project.linkname %}" + <li><a href="{% url 'project-detail' project_id=project.linkname %}" >Project Info</a></li> <li><p class="navbar-text">|</p></li> {% endif %} {% if user.is_authenticated %} - <li><a href="{% url 'patchwork.views.user.todo_lists' %}">Todo + <li><a href="{% url 'user-todos' %}">Todo <span class="badge">{{ user.profile.n_todo_patches }}</span></a> </li> - <li><a href="{% url 'patchwork.views.bundle.bundles' %}">Bundles</a></li> + <li><a href="{% url 'bundle-list' %}">Bundles</a></li> {% if user.is_staff %} <li><a href="{% url 'admin:index' %}">Admin</a></li> {% endif %} @@ -57,14 +57,14 @@ ><strong>{{ user.username }}</strong> <span class="caret" /></a> <ul class="dropdown-menu" role="menu"> - <li><a href="{% url 'patchwork.views.user.profile' %}">View profile</a></li> + <li><a href="{% url 'user-profile' %}">View profile</a></li> <li><a href="{% url 'auth_logout' %}">Logout</a></li> </ul> </li> {% else %} <li><a href="{% url 'auth_login' %}">Login</a></li> - <li><a href="{% url 'patchwork.views.user.register' %}">Register</a></li> - <li><a href="{% url 'patchwork.views.mail.settings' %}">Mail settings</a></li> + <li><a href="{% url 'user-register' %}">Register</a></li> + <li><a href="{% url 'mail-settings' %}">Mail settings</a></li> {% endif %} </div> </div> @@ -72,10 +72,10 @@ {% if project %} <div id="breadcrumb"> <div id="breadcrumb-left"> - <a href="{% url 'patchwork.views.project.list' %}">All projects</a> + <a href="{% url 'project-list' %}">All projects</a> → {% block breadcrumb %} - <a href="{% url 'patchwork.views.patch.list' project_id=project.linkname %}" + <a href="{% url 'patch-list' project_id=project.linkname %}" >{{ project.linkname }} patches</a> {% endblock %} </div> @@ -96,7 +96,7 @@ <div id="footer"> <a href="http://jk.ozlabs.org/projects/patchwork/">patchwork</a> patch tracking system | <a - href="{% url 'patchwork.views.help.help' path="about/" %}">about patchwork</a> + href="{% url 'help' path="about/" %}">about patchwork</a> </div> </body> </html> |