]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
views: Stop using Bundle.public_url
authorStephen Finucane <stephen@that.guru>
Tue, 21 Feb 2017 19:39:07 +0000 (14:39 -0500)
committerStephen Finucane <stephen@that.guru>
Mon, 20 Mar 2017 19:14:06 +0000 (19:14 +0000)
We now have 'get_mbox_url' which is consistent with patches. Let's drop
the older one.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
patchwork/models.py
patchwork/templates/patchwork/bundles.html
patchwork/views/xmlrpc.py

index 199c11827475db9b7f32e0b158c3b3e2f010c5f0..ee929e3b52fd5a0e5f0534b55350bd9f689c6467 100644 (file)
@@ -29,8 +29,6 @@ import re
 import django
 from django.conf import settings
 from django.contrib.auth.models import User
-from django.contrib.sites.models import Site
-from django.core.urlresolvers import reverse
 from django.db import models
 from django.utils.encoding import python_2_unicode_compatible
 from django.utils.functional import cached_property
@@ -723,17 +721,6 @@ class Bundle(models.Model):
         return BundlePatch.objects.create(bundle=self, patch=patch,
                                           order=max_order + 1)
 
-    def public_url(self):
-        if not self.public:
-            return None
-        site = Site.objects.get_current()
-        return 'http://%s%s' % (site.domain,
-                                reverse('bundle-detail',
-                                        kwargs={
-                                            'username': self.owner.username,
-                                            'bundlename': self.name
-                                        }))
-
     @models.permalink
     def get_absolute_url(self):
         return ('bundle-detail', (), {
index 83e1bd0ed56eb902326d476f4d9ace1e33bad6b8..9e225ea0cd1b24754073cb9ca30f74b83e189d26 100644 (file)
   <td>{{ bundle.project.linkname }}</td>
   <td>
    {% if bundle.public %}
-    <a href="{{ bundle.public_url }}">{{ bundle.public_url }}</a>
+    <a href="{{ bundle.get_mbox_url }}">{{ bundle.get_mbox_url }}</a>
    {% endif %}
   </td>
   <td style="text-align: right">{{ bundle.patches.count }}</td>
-  <td style="text-align: center;"><a
-   href="{% url 'bundle-mbox' username=bundle.owner.username bundlename=bundle.name %}"
+  <td style="text-align: center;"><ahref="{{ bundle.get_mbox_url }}"
    ><span class="glyphicon glyphicon-download-alt"></span></a></td>
   <td style="text-align: center;">
    <form method="post"
index 66e908ee2a4f78df38435e10719a4d238c5f5eda..bb8b7299a96eb812c47c7e5a878fe5b83bdefd7c 100644 (file)
@@ -314,7 +314,7 @@ def bundle_to_dict(obj):
         'id': obj.id,
         'name': obj.name,
         'n_patches': obj.patches.count(),
-        'public_url': obj.public_url(),
+        'public_url': obj.get_mbox_url(),
     }