summaryrefslogtreecommitdiff
path: root/patchwork/templatetags
Commit message (Collapse)AuthorAge
* Move to msgid based URLsDaniel Axtens2019-09-25
| | | | | | | | | | | | | | | | | | | | | | | | Migrate our URL schema as follows: Patches: /project/<linkname>/patch/<msgid>/ Cover Letters: /project/<linkname>/cover/<msgid>/ The usual sub-resources (mbox, raw) hang off those URLs. The old style URLs (/patch/NNN/*, /cover/NNN/*) redirect appropriately. I haven't attempted to do anything meaningful with series, and I have dropped any attempt to provide a generic message-id lookup or search functionality. One step at a time. Our database still stores message ids as with angle brackets; we just work around that rather than trying to migrate. That too can come later if we think the pain is justified. Partially-closes: #106 Reported-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Reported-by-but-I-don't-want-to-spam: Linus Torvalds <torvalds@linux-foundation.org> Reported-by: Stephen Finucane <stephen@that.guru> Signed-off-by: Daniel Axtens <dja@axtens.net>
* models: Add commit_url_format to ProjectMichael Ellerman2019-08-30
| | | | | | | | | | | | Add a new field to Project, commit_url_format, which specifies a format string that can be used to generate a link to a particular commit for a project. This is used in the display of a patch, to render the patch's commit as a clickable link back to the commit on the SCM website. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Daniel Axtens <dja@axtens.net>
* templatetags: Do not mark output of msgid tag as safeAndrew Donnellan2019-07-05
| | | | | | | | | | | | | | | | | | The msgid template tag exists to remove angle brackets from either side of the Message-ID header. It also marks its output as safe, meaning it does not get autoescaped by Django templating. Its output is not safe. A maliciously crafted email can include HTML tags inside the Message-ID header, and as long as the angle brackets are not at the start and end of the header, we will quite happily render them. Rather than using mark_safe(), use escape() to explicitly escape the Message-ID. Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net>
* Beautify check counts in the patch list viewAli Alnubani2019-02-25
| | | | | | | | | | | | | | | | | This patch [1] adds colors to the checks in the patch list view. The colors are set based on the check's priority, with FAILURE having the highest priority, followed by WARNING, and then SUCCESS. Only the check with the highest priority and non-zero count will be colored. This is to make failures and warnings more visible. The patch also [2] replaces zero counts with a '-' for FAILUREs and WARNINGs. The SUCCESS count will only be replaced by a '-' when all other checks have zero counts too. Suggested-by: Thomas Monjalon <thomas@monjalon.net> Signed-off-by: Ali Alnubani <alialnu@mellanox.com> Signed-off-by: Stephen Finucane <stephen@that.guru>
* filters: Rework codeStephen Finucane2018-10-13
| | | | | | | Make extensive use of properties, remove dead code, add documentation and generally clean this whole thing up. Signed-off-by: Stephen Finucane <stephen@that.guru>
* Update license headerStephen Finucane2018-09-19
| | | | | | | | | | | | | The FSF has a new address since 2005 that hasn't been noted in any file except the COPYING file. Rather than fix these, simply remove the headers in favour of a SPDX license header. IANAL but the combination of the header and the COPYING file in source should resolve this issue. Note that copyright notices are retained. Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #210 Reviewed-by: Veronika Kabatova <vkabatov@redhat.com>
* Remove '__future__.absolute_import' importsStephen Finucane2018-09-19
| | | | | | | These were added as part of the Python 3 support series but are not required and can be safely removed. Signed-off-by: Stephen Finucane <stephen@that.guru>
* templatetags: Remove dead tagStephen Finucane2018-09-11
| | | | | | Nothing appears to be using this so it can be removed. Signed-off-by: Stephen Finucane <stephen@that.guru>
* Remove compat wrapper for Django < 1.11Stephen Finucane2018-08-26
| | | | | | | Deleting code is fun. We no longer need to carry these so don't. Signed-off-by: Stephen Finucane <stephen@that.guru> Signed-off-by: Daniel Axtens <dja@axtens.net>
* Remove support for Django 1.6, 1.7Stephen Finucane2018-01-04
| | | | | | | | | | | | These versions are massively outdated and the only reason for keeping them was to allow installation on RHEL 7 using the version provided via EPEL. No one's actually using this so just kill it. This also allows us to remove support for django-filter 0.11, which was only retained for use with these older versions of Django. Signed-off-by: Stephen Finucane <stephen@that.guru> Reviewed-by: Daniel Axtens <dja@axtens.net>
* models, templatetags: Make tag count column in patch list optional per tagAndrew Donnellan2018-01-04
| | | | | | | | | | | | | | | Add a field, show_column, to the Tag model to determine whether the tag gets a tag count column in the patch list view. This allows the creation of tags that will be collated when generating mboxes but won't take up space in the patch list. show_column will default to True to maintain the current behaviour by default. Suggested-by: Michael Ellerman <mpe@ellerman.id.au> Closes: #142 ("Ability to add tags that don't also have a column in the UI") Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Stephen Finucane <stephen@that.guru>
* compat: Handle moved 'reverse' functionStephen Finucane2017-05-18
| | | | | | This raises a warning in Django 1.10 and will cause an error in 2.0. Signed-off-by: Stephen Finucane <stephen@that.guru>
* trivial: Resolve pep8 issuesStephen Finucane2016-11-24
| | | | | | | | flake8 3.2.0 updates the pycodestyle dependency to 2.2.0, which in turn resolves a bug with E305. Upgrading results in a small number of additional pep8 issues. Resolve these now. Signed-off-by: Stephen Finucane <stephen@that.guru>
* trivial: Fix pep8 issueStephen Finucane2016-10-20
| | | | | | There should be two lines - not one. Signed-off-by: Stephen Finucane <stephen@that.guru>
* templates: Resolve cycle issues with Django 1.10Stephen Finucane2016-10-10
| | | | | | | | | | The 'future.cycle' template tag is removed in Django 1.10. Since Django 1.7 is still supported by Patchwork, it is necessary to provide a custom 'cycle' wrapper to prevent the deprecation warnings resolved by '9cab078' being reintroduced. Signed-off-by: Stephen Finucane <stephen@that.guru> Reviewed-by: Daniel Axtens <dja@axtens.net>
* trivial: Use implicit true/false for comparisonStephen Finucane2016-09-25
| | | | | Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> Reviewed-by: Daniel Axtens <dja@axtens.net>
* trivial: Remove broad exceptions where possibleStephen Finucane2016-09-25
| | | | | | | | | | | | | | | | The are two somewhat significant changes: * The behavior of 'Bundle.add_patch' is changed. Previously this would raise an exception if the provided patch already existed in the bundle. Since this code was only used in one location, change this to return the BundlePatch if valid else None and change the calling code to check return value instead of catching the exception. * Use a context manager to open the config file in pwclient. This loses a little granularity in error messaging, but this is a worthy compromise. Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> Reviewed-by: Daniel Axtens <dja@axtens.net>
* trivial: Don't shadow built-insStephen Finucane2016-09-24
| | | | | | | | | | | | * Don't use 'str', 'id', 'max', etc. as variable names * Remove unnecessary use of six.range * Remove unnecessary use of six.map There is one paramter in xmlrpc that cannot be renamed as it could break some client code. noqa this instead. Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> Reviewed-by: Daniel Axtens <dja@axtens.net>
* Mark regexes with 'r' prefixesStephen Finucane2016-09-20
| | | | | | Resolves landscape.io errors. Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
* views: Integrate cover letter supportStephen Finucane2016-04-14
| | | | | | | | | | | | There isn't really any need to list cover letters right now, seeing as they're really only valuable in the context of series. However, if someone requests a cover letter by ID then this should be displayed. To this effect, add a new "covers" endpoint that can display the basic elements of the cover letter. This includes redirects from/to the "patches" endpoint. Signed-off-by: Stephen Finucane <stephen.finucane@intel.com> Reviewed-by: Andy Doan <andy.doan@linaro.org>
* models: Merge patch and first commentStephen Finucane2016-03-16
| | | | | | | | | | | | | | | | | | | | | | | | | | At the moment a patch is split into two model entries: a Patch and a linked Comment. The original rationale for this was that a Patch is really a sub-class of Comment. A comment is a record of the text content of an incoming mail, while a patch is that, plus the patch content too. Hence the separation and a one-to-one relationship when a patch is present. However, this decision was made before Django added support for model inheritance and is no longer necessary. This change flatten the models in preparation for some email subclassing work. This is achieved by copying over the non-duplicated fields from the Comment to the linked Patch, then deleting the Comment. The migrations are broken into two steps: a schema migration and a data migration, per the recommendations of the Django documentation [1]. SQL migration scripts, where necessary, will need to be created manually as there appears to be no way to do this in a way that is RDBMS-independant [2][3]. [1] https://docs.djangoproject.com/en/1.9/topics/migrations/#data-migrations [2] https://stackoverflow.com/q/6856849/ [3] https://stackoverflow.com/q/224732/ Signed-off-by: Stephen Finucane <stephen.finucane@intel.com> Reviewed-by: Andy Doan <andy.doan@linaro.org>
* templatetags: fix syntax display of CRLF'sAndy Doan2016-02-17
| | | | | | | | | | | | | | Patches that include CRLF's include extra lines in the UI. Rather than each patch line being: <span ...>content</span> Its source will be: <span ...>content </span> Signed-off-by: Andy Doan <andy.doan@linaro.org> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
* templates: Cleanup patch-listStephen Finucane2016-02-08
| | | | | | | | | | Cleanup this file before doing any work on it. Items addressed: * Move complex logic into template tags * Move related content closer together * Random whitespace annoyances Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
* ui: Don't display the '<' and '>' characters in the message-idDamien Lespiau2016-02-08
| | | | | | Suggested-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
* Use URL names in place of Python pathsStephen Finucane2016-01-19
| | | | | | | | | | | Reversing by Python paths has been deprecated in Django 1.8, causes warnings in Django 1.9 and will be removed in Django 2.0. Resolve the warnings and prevent issues in the future by referring to URLs by name, rather than by Python path. https://docs.djangoproject.com/en/1.9/releases/1.8/#passing-a-dotted-path-to-reverse-and-url Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
* views: Split up 'base'Stephen Finucane2016-01-19
| | | | | | | | This is a collection of unrelated functions, many of which belong in their own file. Do this, taking the opportunity to rename some of these functions to better indicate their purpose in the process. Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
* pep8: Manually resolve remaining issuesStephen Finucane2015-12-03
| | | | | | | | | | | | | | | | The 'autopep8' tool can't do everything, and it is necessary to resolve some final issues. Most of these issues fall under the following categories: E501 line too long E241 multiple spaces after ',' F401 'module' imported but unused F841 local variable 'name' is assigned to but never used It is also necessary to insert '# noqa' comments to hide some F403 errors ('unable to detect undefined names') where 'import *' is useful. Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
* pep8: Autoresolve most PEP8 issuesStephen Finucane2015-12-03
| | | | | | ...using the 'autopep8' tool. Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
* py3: "Modernize" code baseStephen Finucane2015-12-03
| | | | | | | | | | | | | | | | | Run code through the 'modernize' application to fix Python 3 compatibility while also retaining Python 2 backwards compatibility. There are some key changes made to the autogenerated code: * Don't wrap 'items()' in 'list' for for loops - it's not necessary * Don't wrap 'keys()' in 'list' - just drop 'keys()' * Use Django's version of six rather than the upstream one Many of the issues found are based upon the changed definitions of the map, keys and items functions, along with the removal of the iteritems function and reduce keyword. Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
* trivial: Reorder importsStephen Finucane2015-12-03
| | | | | | | | Imports are easier to read if they are grouped by type (standard library, third party, application) and organised alphabetically. Make it so. Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
* py3: Add required 'future' importsStephen Finucane2015-12-03
| | | | | | | | | | These are quite limited as patchwork only supports Python 2.6+. As such, only the 'print_function' and 'absolute_import' statements are required. Found using 'modernize' Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
* templates/patch: Add check summary panelStephen Finucane2015-11-05
| | | | | | | | | | | Add a table to display the checks associated with a patch. This includes the requisite styling along with some additional filters. Signed-off-by: Stephen Finucane <stephen.finucane@intel.com> -- v3: Slight restyling per web UI rework
* templates/patch-list: Add patch "checks" columnStephen Finucane2015-11-05
| | | | | | | | Add a column to display the important "checks" fields for each patch. Note that only the "completed" checks are shown (i.e. "in progress" and "not started" checks are ignored). Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
* Highlight patches with Acked/Reviewed/Tested tagsThomas Petazzoni2015-10-16
| | | | | | | | | | | | | | | | | A little while ago, accounting of the number of Acked-by, Reviewed-by and Tested-by tags was added to patchwork. The count of such tags per patch is shown in the "A / R / T" column. However, since the values are shown for all patches regardless of whether they are zero or not, it makes it not very easy to spot the patches that have at least one Acked-by, Tested-by or Reviewed-by tag. Therefore, this patch proposes to replace a count of "0" by a "-". So patches with no tags will have "- - -" in their A/R/T column, and patches with some tags may get "1 - 1" for example. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
* trivial: Resolve some PEP8 issuesStephen Finucane2015-09-17
| | | | | | Acked-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
* trivial: Remove dead files/codeStephen Finucane2015-09-17
| | | | | | | | | | | | Remove some swathes of code that are no longer used, some of which contains issues that renders them useless. This unused code was initially discovered by using 'coverage.py' followed by manual inspection. Acked-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
* Add patch tag infrastructureJeremy Kerr2015-05-28
| | | | | | | | | | | | | | | | | | | | | This change add patch 'tags', eg 'Acked-by' / 'Reviewed-by', etc., to patchwork. Tag parsing is implemented in the patch parser's extract_tags function, which returns a Counter object of the tags in a comment. These are stored in the PatchTag (keyed to Tag) objects associated with each patch. We need to ensure that the main patch lists do not cause per-patch queries on the Patch.tags ManyToManyField (this would result in ~500 queries per page), so we introduce a new QuerySet (and Manager) for Patch, adding a with_tag_counts() method to populate the tag counts in a single query. As users may be migrating from previous patchwork versions (ie, with no tag counts in the database), we add a 'retag' management command. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Move to a more recent django project structureJeremy Kerr2015-05-27
This change updates patchwor to the newer project struture: we've moved the actual application out of the apps/ directory, and the patchwork-specific templates to under the patchwork application. This gives us the manage.py script in the top-level now. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>