Patchwork broken after server update

Ralf Baechle ralf at linux-mips.org
Wed Jul 31 00:50:36 EST 2013


On Mon, Jul 29, 2013 at 04:46:33PM +0200, Ralf Baechle wrote:

> Django version is 1.5.1, Python 2.7.3, Apache 2.4.4, patchwork is latest
> from git, 4e7b62c5 [notifications: add project name to patch update
> notification].
> 
> Any ideas?

Seems Django 1.5 wants plenty of quotes scattered over the templates.
With below patch patchwork has survived some brief testing.  Somebody with
more of a clue of Django than me should review this.

Thanks,

  Ralf

Signed-off-by: Ralf Baechle <ralf at linux-mips.org>

diff --git a/templates/base.html b/templates/base.html
index 6e5b65b..56091b4 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -13,29 +13,29 @@
   <div id="title">
   <h1 style="float: left;">
      <a
-      href="{% url patchwork.views.projects %}">Patchwork</a>
+      href="{% url 'patchwork.views.projects' %}">Patchwork</a>
     {% block heading %}{% endblock %}</h1>
   <div id="auth">
 {% if user.is_authenticated %}
    Logged in as
-    <a href="{% url patchwork.views.user.profile %}"
+    <a href="{% url 'patchwork.views.user.profile' %}"
      ><strong>{{ user.username }}</strong></a>
     <br/>
-     <a href="{% url patchwork.views.user.todo_lists %}">todo
+     <a href="{% url 'patchwork.views.user.todo_lists' %}">todo
       ({{ user.get_profile.n_todo_patches }})</a> ::
-     <a href="{% url patchwork.views.bundle.bundles %}">bundles</a>
+     <a href="{% url 'patchwork.views.bundle.bundles' %}">bundles</a>
      <br/>
-     <a href="{% url patchwork.views.user.profile %}">profile</a> ::
+     <a href="{% url 'patchwork.views.user.profile' %}">profile</a> ::
 {% if user.is_staff %}
-     <a href="{% url admin:index %}">admin</a> ::
+     <a href="{% url 'admin:index' %}">admin</a> ::
 {% endif %}
-     <a href="{% url auth_logout %}">logout</a>
+     <a href="{% url 'auth_logout' %}">logout</a>
 {% else %}
-     <a href="{% url auth_login %}">login</a>
+     <a href="{% url 'auth_login' %}">login</a>
      <br/>
-     <a href="{% url patchwork.views.user.register %}">register</a>
+     <a href="{% url 'patchwork.views.user.register' %}">register</a>
      <br/>
-     <a href="{% url patchwork.views.mail.settings %}">mail settings</a>
+     <a href="{% url 'patchwork.views.mail.settings' %}">mail settings</a>
 {% endif %}
    </div>
    <div style="clear: both;"></div>
@@ -45,23 +45,23 @@
    {% if project %}
     <strong>Project</strong>: {{ project.linkname }}
      :
-     <a href="{% url patchwork.views.patch.list project_id=project.linkname %}"
+     <a href="{% url 'patchwork.views.patch.list' project_id=project.linkname %}"
       >patches</a>
      :
-     <a href="{% url patchwork.views.project.project project_id=project.linkname %}"
+     <a href="{% url 'patchwork.views.project.project' project_id=project.linkname %}"
       >project info</a>
     {% if other_projects %}
      :
-     <a href="{% url patchwork.views.projects %}"
+     <a href="{% url 'patchwork.views.projects' %}"
      >other projects</a>
      {% endif %}
     {% else %}
-     <a href="{% url patchwork.views.projects %}"
+     <a href="{% url 'patchwork.views.projects' %}"
      >project list</a>
     {% endif %}
    </div>
    <div id="navright">
-    <a href="{% url patchwork.views.help path="about/" %}">about</a>
+    <a href="{% url 'patchwork.views.help' path="about/" %}">about</a>
    </div>
    <div style="clear: both"></div>
   </div>
diff --git a/templates/patchwork/activation_email.txt b/templates/patchwork/activation_email.txt
index e918e5f..caf514a 100644
--- a/templates/patchwork/activation_email.txt
+++ b/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 'patchwork.views.confirm' key=confirmation.key %}
 
 If you didn't request a user account on patchwork, then you can ignore
 this mail.
diff --git a/templates/patchwork/bundle.html b/templates/patchwork/bundle.html
index 4bc6e08..d47cf13 100644
--- a/templates/patchwork/bundle.html
+++ b/templates/patchwork/bundle.html
@@ -22,7 +22,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 'patchwork.views.bundle.mbox' username=bundle.owner.username bundlename=bundle.name %}">Download bundle as mbox</a></p>
 
 {% if bundleform %}
 <form method="post">
diff --git a/templates/patchwork/bundles.html b/templates/patchwork/bundles.html
index 3624f81..a725d95 100644
--- a/templates/patchwork/bundles.html
+++ b/templates/patchwork/bundles.html
@@ -26,7 +26,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 'patchwork.views.bundle.mbox' username=bundle.owner.username bundlename=bundle.name %}"
    ><img src="/images/16-em-down.png" width="16" height="16" alt="download"
    title="download"/></a></td>
   <td style="text-align: center;">
diff --git a/templates/patchwork/filters.html b/templates/patchwork/filters.html
index 3698101..3a14492 100644
--- a/templates/patchwork/filters.html
+++ b/templates/patchwork/filters.html
@@ -131,7 +131,7 @@ function submitter_field_change(field)
          return;
     }
 
-    var url = '{% url patchwork.views.submitter_complete %}?q=' + value;
+    var url = '{% url 'patchwork.views.submitter_complete' %}?q=' + value;
     req = new XMLHttpRequest();
     req.onreadystatechange = submitter_complete_response;
     req.open("GET", url, true);
diff --git a/templates/patchwork/help/pwclient.html b/templates/patchwork/help/pwclient.html
index a260202..7101ec1 100644
--- a/templates/patchwork/help/pwclient.html
+++ b/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</a>
+ <li>The <a href="{% url 'patchwork.views.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 'patchwork.views.projects' %}">patchwork project</a>
 provides a sample linked from the 'project info' page.</p>
 
 {% endblock %}
diff --git a/templates/patchwork/mail-settings.html b/templates/patchwork/mail-settings.html
index 303139a..440af08 100644
--- a/templates/patchwork/mail-settings.html
+++ b/templates/patchwork/mail-settings.html
@@ -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 'patchwork.views.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 'patchwork.views.mail.optout' %}">
     {% csrf_token %}
     <input type="hidden" name="email" value="{{email}}"/>
     <input type="submit" value="Opt-out"/>
diff --git a/templates/patchwork/optin-request.html b/templates/patchwork/optin-request.html
index 63a4e12..3dfb1bd 100644
--- a/templates/patchwork/optin-request.html
+++ b/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 'patchwork.views.user.profile' %}">user
 profile</a>.</p>
 {% endif %}
 
diff --git a/templates/patchwork/optin-request.mail b/templates/patchwork/optin-request.mail
index 34dd2c7..d97c78b 100644
--- a/templates/patchwork/optin-request.mail
+++ b/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 'patchwork.views.confirm' key=confirmation.key %}
 
 If you didn't request this opt-in, you don't need to do anything.
 
diff --git a/templates/patchwork/optin.html b/templates/patchwork/optin.html
index f7c0c04..01aaa0e 100644
--- a/templates/patchwork/optin.html
+++ b/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 'patchwork.views.mail.settings' %}"
+>http://{{site.domain}}{% url 'patchwork.views.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 'patchwork.views.user.profile' %}">user
 profile</a>.</p>
 {% endif %}
 {% endblock %}
diff --git a/templates/patchwork/optout-request.html b/templates/patchwork/optout-request.html
index dbdf250..092dbbb 100644
--- a/templates/patchwork/optout-request.html
+++ b/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 'patchwork.views.user.profile' %}">user
 profile</a>.</p>
 {% endif %}
 
diff --git a/templates/patchwork/optout-request.mail b/templates/patchwork/optout-request.mail
index f896e3c..67203ca 100644
--- a/templates/patchwork/optout-request.mail
+++ b/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 'patchwork.views.confirm' key=confirmation.key %}
 
 If you didn't request this opt-out, you don't need to do anything.
 
diff --git a/templates/patchwork/optout.html b/templates/patchwork/optout.html
index 6b97806..b140bf4 100644
--- a/templates/patchwork/optout.html
+++ b/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 'patchwork.views.mail.settings' %}"
+>http://{{site.domain}}{% url 'patchwork.views.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 'patchwork.views.user.profile' %}">user
 profile</a>.</p>
 {% endif %}
 {% endblock %}
diff --git a/templates/patchwork/patch-change-notification.mail b/templates/patchwork/patch-change-notification.mail
index b7e2cfe..4246704 100644
--- a/templates/patchwork/patch-change-notification.mail
+++ b/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 'patchwork.views.mail.settings' %}
diff --git a/templates/patchwork/patch-list.html b/templates/patchwork/patch-list.html
index 723c4a0..59adbe3 100644
--- a/templates/patchwork/patch-list.html
+++ b/templates/patchwork/patch-list.html
@@ -143,7 +143,7 @@
     <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 'patchwork.views.patch.patch' patch_id=patch.id %}"
      >{{ patch.name|default:"[no subject]" }}</a></td>
    <td>{{ patch.date|date:"Y-m-d" }}</td>
    <td>{{ patch.submitter|personify }}</td>
diff --git a/templates/patchwork/patch.html b/templates/patchwork/patch.html
index 25c9962..813622b 100644
--- a/templates/patchwork/patch.html
+++ b/templates/patchwork/patch.html
@@ -43,10 +43,10 @@ function toggle_headers(link_id, headers_id)
  <tr>
   <th>Download</th>
   <td>
-   <a href="{% url patchwork.views.patch.mbox patch_id=patch.id %}"
+   <a href="{% url 'patchwork.views.patch.mbox' patch_id=patch.id %}"
    >mbox</a>
 {% if patch.content %}|
-   <a href="{% url patchwork.views.patch.content patch_id=patch.id %}"
+   <a href="{% url 'patchwork.views.patch.content' patch_id=patch.id %}"
    >patch</a>
 {% endif %}
    </td>
diff --git a/templates/patchwork/profile.html b/templates/patchwork/profile.html
index c02845b..4230cf0 100644
--- a/templates/patchwork/profile.html
+++ b/templates/patchwork/profile.html
@@ -10,14 +10,14 @@
 {% if user.get_profile.maintainer_projects.count %}
 Maintainer of
 {% for project in user.get_profile.maintainer_projects.all %}
-<a href="{% url patchwork.views.patch.list project_id=project.linkname %}"
+<a href="{% url 'patchwork.views.patch.list' project_id=project.linkname %}"
 >{{ project.linkname }}</a>{% if not forloop.last %},{% endif %}{% endfor %}.
 {% endif %}
 
 {% if user.get_profile.contributor_projects.count %}
 Contributor to
 {% for project in user.get_profile.contributor_projects.all %}
-<a href="{% url patchwork.views.patch.list project_id=project.linkname %}"
+<a href="{% url 'patchwork.views.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.get_profile.n_todo_patches %}
- <p>Your <a href="{% url patchwork.views.user.todo_lists %}">todo
+ <p>Your <a href="{% url 'patchwork.views.user.todo_lists' %}">todo
   list</a> contains {{ user.get_profile.n_todo_patches }}
   patch{{ user.get_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 'patchwork.views.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 'patchwork.views.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 'patchwork.views.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 'patchwork.views.user.link' %}" method="post">
     {% csrf_token %}
     {{ linkform.email }}
     <input type="submit" value="Add"/>
@@ -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 'django.contrib.auth.views.password_change' %}">Change password</a>
 </div>
 
 </div>
diff --git a/templates/patchwork/project.html b/templates/patchwork/project.html
index 5b2cc13..73e85df 100644
--- a/templates/patchwork/project.html
+++ b/templates/patchwork/project.html
@@ -49,9 +49,9 @@
 </table>
 
 {% if settings.ENABLE_XMLRPC %}
-<p>Sample <a href="{% url patchwork.views.help "pwclient/" %}">patchwork
+<p>Sample <a href="{% url 'patchwork.views.help' "pwclient/" %}">patchwork
 client</a> configuration for this project: <a
-href="{% url patchwork.views.pwclientrc project.linkname %}"
+href="{% url 'patchwork.views.pwclientrc' project.linkname %}"
 >.pwclientrc</a>.</p>
 {% endif %}
   
diff --git a/templates/patchwork/projects.html b/templates/patchwork/projects.html
index ad98bc3..5ccae9b 100644
--- a/templates/patchwork/projects.html
+++ b/templates/patchwork/projects.html
@@ -9,7 +9,7 @@
  <dl>
  {% for p in projects %}
   <dt>
-   <a href="{% url patchwork.views.patch.list project_id=p.linkname %}"
+   <a href="{% url 'patchwork.views.patch.list' project_id=p.linkname %}"
     >{{p.linkname}}</a>
   </dt>
   <dd>{{p.name}}
diff --git a/templates/patchwork/pwclientrc b/templates/patchwork/pwclientrc
index c932b11..436a28b 100644
--- a/templates/patchwork/pwclientrc
+++ b/templates/patchwork/pwclientrc
@@ -4,7 +4,7 @@
 # Save this file to ~/.pwclientrc
 #
 [base]
-url: {{scheme}}://{{site.domain}}{% url patchwork.views.xmlrpc.xmlrpc %}
+url: {{scheme}}://{{site.domain}}{% url 'patchwork.views.xmlrpc.xmlrpc' %}
 project: {{ project.linkname }}
 {% if user.is_authenticated %}
 # Adding authentication parameters will allow you to use the 'update'
diff --git a/templates/patchwork/register.mail b/templates/patchwork/register.mail
index 9bb5232..9079203 100644
--- a/templates/patchwork/register.mail
+++ b/templates/patchwork/register.mail
@@ -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 registration_activateactivation_key=request.key %}
+ http://{{site.domain}}{% url 'registration_activateactivation_key'=request.key %}
 
 If you didn't request a user account on patchwork, then you can ignore
 this mail.
diff --git a/templates/patchwork/registration-confirm.html b/templates/patchwork/registration-confirm.html
index f0cc39f..6111401 100644
--- a/templates/patchwork/registration-confirm.html
+++ b/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 'patchwork.views.user.profile' %}">profile</a> to start using
 patchwork's extra features.</p>
 
 {% endblock %}
diff --git a/templates/patchwork/todo-lists.html b/templates/patchwork/todo-lists.html
index 47dbf03..e268160 100644
--- a/templates/patchwork/todo-lists.html
+++ b/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 'patchwork.views.user.todo_list' project_id=todo_list.project.linkname %}"
     >{{ todo_list.project.name }}</a></td>
   <td class="numberformat">{{ todo_list.n_patches }}</td>
  </tr>
diff --git a/templates/patchwork/user-link-confirm.html b/templates/patchwork/user-link-confirm.html
index 3e7b6ed..449bfeb 100644
--- a/templates/patchwork/user-link-confirm.html
+++ b/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 'patchwork.views.user.profile' %}">your
  profile</a>.</p>
 
 {% endblock %}
diff --git a/templates/patchwork/user-link.html b/templates/patchwork/user-link.html
index 10c8ec2..e436c3a 100644
--- a/templates/patchwork/user-link.html
+++ b/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 'patchwork.views.user.link' %}" method="post">
     {% csrf_token %}
     {{linkform.email.errors}}
     Link an email address: {{ linkform.email }}
diff --git a/templates/patchwork/user-link.mail b/templates/patchwork/user-link.mail
index c483181..8db6726 100644
--- a/templates/patchwork/user-link.mail
+++ b/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 'patchwork.views.confirm' key=confirmation.key %}
 
 Happy patchworking.


More information about the Patchwork mailing list