Commit 492485df authored by Arkadiusz Hiler's avatar Arkadiusz Hiler

urls: Use named URLs

Using the quoted doted path to the view callable object
(e.g. 'patchwork.views.projects') is going to be deprecated soon.
Using either the actual callable or a named URL is recommended.

Let future-proof urls.py by using the actual callables there and
name all the URLs, so we can use the names everywhere else.
Signed-off-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent f5869cb5
......@@ -391,7 +391,7 @@ class Patch(models.Model):
@models.permalink
def get_absolute_url(self):
return ('patchwork.views.patch.patch', (), {'patch_id': self.id})
return ('patch', (), {'patch_id': self.id})
def __str__(self):
return self.name
......@@ -467,7 +467,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',
kwargs={
'username': self.owner.username,
'bundlename': self.name
......@@ -475,7 +475,7 @@ class Bundle(models.Model):
@models.permalink
def get_absolute_url(self):
return ('patchwork.views.bundle.bundle', (), {
return ('bundle', (), {
'username': self.owner.username,
'bundlename': self.name,
})
......
......@@ -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.
......
......@@ -14,7 +14,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">
......
......@@ -29,7 +29,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;">
......
......@@ -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</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.projects' %}">Patchwork project</a>
<a href="{% url 'root' %}">Patchwork project</a>
provides a sample linked from the 'project info' page.</p>
{% endblock %}
......@@ -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>
......
......@@ -13,7 +13,7 @@
<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"/>
......@@ -24,7 +24,7 @@
<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"/>
......
......@@ -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' %}">user
profile</a>.</p>
{% endif %}
......
......@@ -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.
......
......@@ -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' %}">user
profile</a>.</p>
{% endif %}
{% endblock %}
......@@ -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' %}">user
profile</a>.</p>
{% endif %}
......
......@@ -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.
......
......@@ -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' %}">user
profile</a>.</p>
{% endif %}
{% endblock %}
......@@ -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' %}
......@@ -151,7 +151,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' patch_id=patch.id %}"
>{{ patch.name|default:"[no subject]"|truncatechars:100 }}</a></td>
{% for tag in project.tags %}
{{ patch|patch_tags:tag }}
......
......@@ -196,11 +196,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_content' 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">
......
......@@ -11,14 +11,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>
......@@ -27,7 +27,7 @@ Contributor to
<div class="box">
<h2>Todo</h2>
{% if user.profile.n_todo %}
<p>Your <a href="{% url 'patchwork.views.user.todo_lists' %}">todo
<p>Your <a href="{% url 'todo_lists' %}">todo
list</a> contains {{ user.profile.n_todo }}
item{{ user.profile.n_todo|pluralize:"s" }}.</p>
{% else %}
......@@ -57,7 +57,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"/>
......@@ -66,14 +66,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}}"/>
......@@ -85,7 +85,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"/>
......@@ -108,7 +108,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>
......@@ -135,7 +135,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>
......
......@@ -54,9 +54,9 @@
</table>
{% if settings.ENABLE_XMLRPC %}
<p>Sample <a href="{% url 'patchwork.views.help' "pwclient/" %}">Patchwork
<p>Sample <a href="{% url 'help' "pwclient/" %}">Patchwork
client</a> configuration for this project: <a
href="{% url 'patchwork.views.pwclientrc' project.linkname %}"
href="{% url 'pwclientrc' project.linkname %}"
>.pwclientrc</a>.</p>
{% endif %}
......
......@@ -4,7 +4,7 @@
{% block navbarmenu %}
<ul class="nav navbar-nav">
<li class="active">
<a href="{% url 'patchwork.views.projects' %}">
<a href="{% url 'root' %}">
<span class="glyphicon glyphicon-home"></span>
All projects</a>
</li>
......
......@@ -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>
......
......@@ -7,7 +7,7 @@
<p>Registration 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</a> to start using
Patchwork's extra features.</p>
{% endblock %}
......@@ -132,7 +132,7 @@ $(document).ready(function() {
{% for patch in revision.patch_list %}
<tr>
<td></td>
<td><a href="{% url 'patchwork.views.patch.patch' patch_id=patch.id %}"
<td><a href="{% url 'patch' patch_id=patch.id %}"
>{{ patch.name|default:"[no subject]"|truncatechars:100 }}</a></td>
<td>{{ patch.submitter|personify:project }}</td>
<td>{{ patch.state }}</td>
......
......@@ -18,7 +18,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 'todo_list' project_id=todo_list.project.linkname %}"
>{{ todo_list.project.name }}</a></td>
<td class="numberformat">{{ todo_list.n_series }}</td>
<td class="numberformat">{{ todo_list.n_patches }}</td>
......
......@@ -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' %}">your
profile</a>.</p>
{% endblock %}
......@@ -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 }}
......
......@@ -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.
......@@ -38,8 +38,7 @@ def personify(person, project):
else:
linktext = escape(person.email)
url = reverse('patchwork.views.patch.list', kwargs={
'project_id': project.linkname})
url = reverse('patch_list', kwargs={'project_id': project.linkname})
str = '<a href="%s?%s=%s">%s</a>' % \
(url, SubmitterFilter.param, escape(person.id), linktext)
......
......@@ -25,7 +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):
......
......@@ -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')
......@@ -105,7 +104,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')
......@@ -114,7 +113,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')
......@@ -123,7 +122,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')
......@@ -133,7 +132,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')
......
......@@ -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,18 @@ 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'))
self.assertRedirects(response, reverse('mail_settings'))
def testOptoutRequestValidPOST(self):
email = u'foo@example.com'
......@@ -103,7 +102,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 +130,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)
......@@ -165,14 +163,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})
......@@ -187,7 +184,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])
......@@ -222,8 +219,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)
......@@ -242,7 +238,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'
......@@ -259,9 +255,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')
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>')
......
......@@ -28,7 +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):
......
......@@ -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': '*',
......
......@@ -29,7 +29,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):
......@@ -197,9 +197,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()
......
......@@ -66,14 +66,13 @@ class XMLRPCTest(LiveServerTestCase):
p = urlparse.urlparse(self.live_server_url)
self.url = (p.scheme + '://' + self.maintainer.username + ':' +
self.maintainer.password + '@' + p.netloc + p.path +
reverse('patchwork.views.xmlrpc.xmlrpc'))
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',
kwargs={'path': 'pwclient/'}))
reverse('help', kwargs={'path': 'pwclient/'}))
def testList(self):
patch = self._insert_patch()
......
......@@ -18,12 +18,20 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.conf import settings
from django.conf.urls import patterns, url, include
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth import views as auth_views
from rest_framework_nested import routers
from patchwork.views.series import SeriesListView, SeriesView
import patchwork.views.api as api
import patchwork.views
import patchwork.views.bundle
import patchwork.views.project
import patchwork.views.patch
import patchwork.views.user
import patchwork.views.mail
import patchwork.views.base
import patchwork.views.xmlrpc
# API
......@@ -67,54 +75,67 @@ patch_results_router.register(r'test-results', api.PatchResultViewSet,
admin.autodiscover()
urlpatterns = patterns(
'',
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
# API
url(r'^api/1.0/$', api.API.as_view(), name='api-root'),
(r'^api/1.0/', include(project_router.urls)),
(r'^api/1.0/', include(patches_list_router.urls)),
(r'^api/1.0/', include(series_list_router.urls)),
(r'^api/1.0/', include(series_router.urls)),
(r'^api/1.0/', include(revisions_router.urls)),
(r'^api/1.0/', include(revision_results_router.urls)),
(r'^api/1.0/', include(patches_router.urls)),
(r'^api/1.0/', include(patch_results_router.urls)),
(r'^api/1.0/', include(event_router.urls)),
url(r'^api/1.0/', include(project_router.urls)),
url(r'^api/1.0/', include(patches_list_router.urls)),
url(r'^api/1.0/', include(series_list_router.urls)),
url(r'^api/1.0/', include(series_router.urls)),
url(r'^api/1.0/', include(revisions_router.urls)),
url(r'^api/1.0/', include(revision_results_router.urls)),
url(r'^api/1.0/', include(patches_router.urls)),
url(r'^api/1.0/', include(patch_results_router.urls)),
url(r'^api/1.0/', include(event_router.urls)),
# project views:
url(r'^$', 'patchwork.views.projects', name='root'),
(r'^project/(?P<project_id>[^/]+)/list/$', 'patchwork.views.patch.list'),
url(r'^$', patchwork.views.base.projects,
name='root'),
url(r'^project/(?P<project_id>[^/]+)/list/$', patchwork.views.patch.list,
name='patch_list'),
url(r'^project/(?P<project_id>[^/]+)/patches/$',
'patchwork.views.patch.list', name='patches_list'),
(r'^project/(?P<project_id>[^/]+)/$', 'patchwork.views.project.project'),
patchwork.views.patch.list,
name='patches_list'),
url(r'^project/(?P<project_id>[^/]+)/$', patchwork.views.project.project,
name='project'),
# series views
url(r'^project/(?P<project>[^/]+)/series/$', SeriesListView.as_view(),
name='series_list'),
url(r'^series/(?P<series>\d+)/$', SeriesView.as_view(), name='series'),
url(r'^series/(?P<series>\d+)/$', SeriesView.as_view(),
name='series'),
# patch views
(r'^patch/(?P<patch_id>\d+)/$', 'patchwork.views.patch.patch'),
(r'^patch/(?P<patch_id>\d+)/raw/$', 'patchwork.views.patch.content'),
(r'^patch/(?P<patch_id>\d+)/mbox/$', 'patchwork.views.patch.mbox'),
(r'^patch/msgid/(?P<msgid>[^/]+)/$', 'patchwork.views.patch.msgid'),
url(r'^patch/(?P<patch_id>\d+)/$', patchwork.views.patch.patch,
name='patch'),
url(r'^patch/(?P<patch_id>\d+)/raw/$', patchwork.views.patch.content,
name='patch_content'),
url(r'^patch/(?P<patch_id>\d+)/mbox/$', patchwork.views.patch.mbox,
name='patch_mbox'),
url(r'^patch/msgid/(?P<msgid>[^/]+)/$', patchwork.views.patch.msgid,
name='patch_msgid'),
# project bundles
url(r'^project/(?P<project_id>[^/]+)/bundles/$',
'patchwork.views.bundle.bundles', name='bundle_list'),
patchwork.views.bundle.bundles,
name='bundle_list'),
# logged-in user stuff
url(r'^user/$', 'patchwork.views.user.profile', name='user'),
(r'^user/todo/$', 'patchwork.views.user.todo_lists'),