Patchwork Remove unused templates and some code for processing them.

login
register
mail settings
Submitter Guilherme Salgado
Date Feb. 23, 2011, 4:34 p.m.
Message ID <20110223163211.404.63660.stgit@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/84206/
State Accepted
Commit f7a3c5dff0da19e6bd737c51187a1f5aa7373c67
Headers show

Comments

Guilherme Salgado - Feb. 23, 2011, 4:34 p.m.
These seem to be what was used in the past to archive/unarchive and delete
patches.

Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org>
---

I couldn't find anything using these removed bits, but given that there's not
many tests for the views/templates it's possible I might have gone too far
with the removals.  Please let me know if this is the case.

 apps/patchwork/utils.py       |   17 -----------------
 apps/patchwork/views/patch.py |   17 -----------------
 2 files changed, 0 insertions(+), 34 deletions(-)
Jeremy Kerr - Feb. 28, 2011, 5:13 a.m.
Hi Guilherme,

> These seem to be what was used in the past to archive/unarchive and delete
> patches.

IIRC, we still need the code (in set_patches) for archive/unarchive - but the 
deletion (and ack) stuff should be fine.

Cheers,


Jeremy
Guilherme Salgado - Feb. 28, 2011, 12:06 p.m.
On Mon, 2011-02-28 at 13:13 +0800, Jeremy Kerr wrote:
> Hi Guilherme,
> 
> > These seem to be what was used in the past to archive/unarchive and delete
> > patches.
> 
> IIRC, we still need the code (in set_patches) for archive/unarchive - but the 
> deletion (and ack) stuff should be fine.

I don't see how those could be used as the new templates no longer have
archive/unarchive form actions -- now there's just a checkbox labeled
'Archived' which is supposedly handled by PatchForm/MultiplePatchForm.

Notice that, currently, MultiplePatchForm handles that checkbox
incorrectly, but one of the patches I submitted fixes it.

Cheers,
Jeremy Kerr - March 8, 2011, 5:34 a.m.
Hi Guilherme,

> I don't see how those could be used as the new templates no longer have
> archive/unarchive form actions -- now there's just a checkbox labeled
> 'Archived' which is supposedly handled by PatchForm/MultiplePatchForm.

Ah yep, the reference I was looking at was from an unused template (which the 
patch also removes).

Thanks for that, applied.

Cheers,


Jeremy

Patch

diff --git a/apps/patchwork/utils.py b/apps/patchwork/utils.py
index 3f2b433..53cf40b 100644
--- a/apps/patchwork/utils.py
+++ b/apps/patchwork/utils.py
@@ -173,23 +173,6 @@  def set_patches(user, project, action, data, patches, context):
             form.save(patch)
             str = 'updated'
 
-        elif action == 'ack':
-            pass
-
-        elif action == 'archive':
-            patch.archived = True
-            patch.save()
-            str = 'archived'
-
-        elif action == 'unarchive':
-            patch.archived = False
-            patch.save()
-            str = 'un-archived'
-
-        elif action == 'delete':
-            patch.delete()
-            str = 'un-archived'
-
 
     if len(patches) > 0:
         if len(patches) == 1:
diff --git a/apps/patchwork/views/patch.py b/apps/patchwork/views/patch.py
index 7114104..1583009 100644
--- a/apps/patchwork/views/patch.py
+++ b/apps/patchwork/views/patch.py
@@ -76,23 +76,6 @@  def patch(request, patch_id):
                 form.save()
                 context.add_message('Patch updated')
 
-        elif action == 'archive':
-            patch.archived = True
-            patch.save()
-            context.add_message('Patch archived')
-
-        elif action == 'unarchive':
-            patch.archived = False
-            patch.save()
-            context.add_message('Patch un-archived')
-
-        elif action == 'ack':
-            pass
-
-        elif action == 'delete':
-            patch.delete()
-
-
     context['patch'] = patch
     context['patchform'] = form
     context['createbundleform'] = createbundleform
diff --git a/templates/patchwork/patch-form.html b/templates/patchwork/patch-form.html
deleted file mode 100644
index aae673a..0000000
--- a/templates/patchwork/patch-form.html
+++ /dev/null
@@ -1,91 +0,0 @@ 
-
-<div class="patchform"
-  style="border: thin solid black; padding-left: 0.8em; margin-top: 2em;">
-
- <div class="patchform-properties"
-  style="float: left; margin-right: 4em;">
-  <h3>Properties</h3>
-    <table class="form">
-     <tr>
-      <th>Change state:</th>
-      <td>{{ patchform.state }}</td>
-     </tr>
-     <tr>
-      <th>Delegate to:</td>
-      <td>{{ patchform.delegate }}</td>
-     </tr>
-     <tr>
-      <td></td>
-      <td>
-       <input type="submit" value="Update">
-      </td>
-     </tr>
-    </table>
-  </form>
- </div>
-
- <div class="patchform-actions" style="padding-left: 4em;">
-  <h3>Actions</h3>
-   <table class="form">
-    <tr>
-     <td>Ack:</td>
-     <td>
-      <form action="{% url patchwork.views.patch patch=patch.id %}"
-       method="post">
-       {% csrf_token %}
-       <input type="hidden" name="action" value="act"/>
-       <input type="submit" value="Ack"/>
-      </form>
-     </td>
-    </tr>
-    <tr>
-     <td>Create bundle:</td>
-     <td>
-       {% if createbundleform.name.errors %}
-       <span class="errors">{{createbundleform.errors}}</span>
-       {% endif %}
-      <form method="post">
-       {% csrf_token %}
-       <input type="hidden" name="action" value="createbundle"/>
-        {{ createbundleform.name }}
-       <input value="Create" type="submit"/>
-      </form>
-      </td>
-    </tr>
-{% if bundles %}
-    <tr>
-     <td>Add to bundle:</td>
-     <td>
-      <form action="{% url patchwork.views.bundle.setbundle %}" method="post">
-       {% csrf_token %}
-       <input type="hidden" name="action" value="add"/>
-       <input type="hidden" name="patch_id" value="{{ patch.id }}"/>
-       <select name="name"/>
-        {% for bundle in bundles %}
-         <option value="{{bundle.id}}">{{bundle.name}}</option>
-        {% endfor %}
-        </select>
-       <input value="Add" type="submit"/>
-      </form>
-     </td>
-    </tr>
-{% endif %}
-    <tr>
-     <td>Archive:</td>
-     <td>
-      <form method="post">
-       {% csrf_token %}
-       <input type="hidden" name="action" value="archive"/>
-       <input type="submit" value="Archive"/>
-      </form>
-     </td>
-    </tr>
-   </table>
-  </form>
-
- </div>
-
- <div style="clear: both;">
- </div>
-</div>
-
diff --git a/templates/patchwork/patch-list.html b/templates/patchwork/patch-list.html
index fe4d606..43e0550 100644
--- a/templates/patchwork/patch-list.html
+++ b/templates/patchwork/patch-list.html
@@ -198,15 +198,6 @@ 
  <div class="patchform patchform-bundle">
   <h3>Bundling</h3>
    <table class="form">
-   <!--
-    <tr>
-     <td>Ack:</td>
-     <td>
-       <input type="submit" name="action" value="Ack"/>
-      </form>
-     </td>
-    </tr>
-    -->
     <tr>
      <td>Create bundle:</td>
      <td>
diff --git a/templates/patchwork/patch.html b/templates/patchwork/patch.html
index b9addc6..25c9962 100644
--- a/templates/patchwork/patch.html
+++ b/templates/patchwork/patch.html
@@ -127,19 +127,6 @@  function toggle_headers(link_id, headers_id)
  <div class="patchform patchform-bundle">
   <h3>Bundling</h3>
    <table class="form">
-   <!--
-    <tr>
-     <td>Ack:</td>
-     <td>
-      <form action="{% url patchwork.views.patch.patch patch_id=patch.id %}"
-       method="post">
-       {% csrf_token %}
-       <input type="hidden" name="action" value="act"/>
-       <input type="submit" value="Ack"/>
-      </form>
-     </td>
-    </tr>
-    -->
     <tr>
      <td>Create bundle:</td>
      <td>
@@ -180,26 +167,6 @@  function toggle_headers(link_id, headers_id)
  </div>
 {% endif %}
 
-{% if actionsform %}
- <div class="patchform patchform-actions">
-  <h3>Actions</h3>
-   <table class="form">
-    <tr>
-     <td>Ack:</td>
-     <td>
-      <form action="{% url patchwork.views.patch.patch patch_id=patch.id %}"
-       method="post">
-       {% csrf_token %}
-       <input type="hidden" name="action" value="act"/>
-       <input type="submit" value="Ack"/>
-      </form>
-     </td>
-    </tr>
-   </table>
-  </form>
- </div>
-
-{% endif %}
  <div style="clear: both;">
  </div>
 </div>
diff --git a/templates/patchwork/patchlist.html b/templates/patchwork/patchlist.html
deleted file mode 100644
index d6709cd..0000000
--- a/templates/patchwork/patchlist.html
+++ /dev/null
@@ -1,37 +0,0 @@ 
-
-{% load person %}
-
-{% if patches %}
-<form method="post">
-{% csrf_token %}
-<table class="patchlist">
- <tr>
-  {% if patchform %}
-  <th/>
-  {% endif %}
-  <th><a class="colinactive" href="list?person=846&order=patch">Patch</a></th>
-  <th><a class="colinactive" href="list?person=846&order=date">Date</a></th>
-  <th><a class="colinactive" href="list?person=846&order=submitter">Submitter</a></th>
-  <th><a class="colinactive" href="list?person=846&order=state">State</a></th>
- </tr>
- {% for patch in patches %}
-  <tr>
-    {% if patchform %}
-    <td>
-    <input type="hidden" name="patch_ids" value="{{ patch.id }}"/>
-    <input type="checkbox" name="patch-{{patch.id}}">
-    </td>
-    {% endif %}
-   <td><a href="{% url patchwork.views.patch.patch patch_id=patch.id %}">{{ patch.name }}</a></td>
-   <td>{{ patch.date|date:"Y-m-d" }}</td>
-   <td>{{ patch.submitter|personify }}</td>
-   <td>{{ patch.state }}</td>
-  </tr>
- {% endfor %}
-</table>
-
-{% include "patchwork/patch-form.html" %}
-
-{% else %}
- <p>No patches to display</p>
-{% endif %}