Using exceptions for flow control is bad. Be consistent and instead
use proper functions to check for version support. This also allows
the use of tools to automatically identify feature flags when
removing support for Django versions in the future.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Thu, 23 Jul 2015 10:54:04 +0000 (11:54 +0100)]
templates/patch-list: Add patch "checks" column
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>
Stephen Finucane [Thu, 23 Jul 2015 10:53:13 +0000 (11:53 +0100)]
models: Add properties related to checks
Add properties for 'Patch' to get the unique checks associated with
a patch, the total number of each type of check and the combined state
of the check. These will be necessary to display this information to
the user.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Though already mentioned in the CHANGELOG, the UPGRADING document
should describe plans to deprecate support for Django 1.6. This will
ensure sysadmins are not suprised when they attempt to upgrade.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
tests: Add a way for the user to skip selenium tests
It's a bit more convoluted to setup the test environment to work with
selenium (eg. needs a browser installed and Xorg running, ...). It's
possible someone would want to skip those.
v2: Use 'PW' prefix rather than 'PATCHWORK', per existing test
parameters, and pass said variable through tox
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
While developing the new series UI, several bug crept in but weren't
discovered until later. All because we don't have in-browser tests to go
along the lower level tests we already have.
In particular, behaviours that need javascript to run cannot be tested
outside of a full environment with the pages being served to an actual
browser.
This commit introduces selenium to the test suite and starts with 2
simple tests to give a taste of what it looks like.
test_default_focus: make sure we do focus the username field on the
login page
test_login: shows how to chain actions to test the full login phase.
This is quite similar the lower level test, except it also
checks we display the username once logged in.
v2: Use LiveServerTestCase for django pre-1.7
v3: Propagate the DISPLAY environment variable to have an X display
specified for the browser
v4: Log execution of the chrome driver, useful for debugging
v5: Rebase on top of upstream
v6: Pass environmental variables to tox and ensure PEP8 compliance
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
In the case where the tests are run by multiple processes in parallel
(for example, in the context of several simultaneous continuous
integration builds), the processes will compete for the same address, and
therefore your tests might randomly fail with an "Address already in use"
error. For example:
Traceback (most recent call last):
File
".../python2.7/site-packages/django/test/testcases.py",
line 1193, in setUpClass
raise cls.server_thread.error
error: [Errno 98] Address already in use
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
tests: Don't change settings.STATIC_URL in the XML-RPC tests
I tracked down a weird bug where the Selenium tests supposed to serve
all static files (.css, .js. ...) weren't doing so when running the
full test suite, but everything was working when running the tests in
isolation.
Turns out one of the other tests was changing settings.STATIC_URL
mid-way without restoring the original value in tearDown() and thus
impacting other tests.
It seems that this change wasn't necessary, the XML-RPC server doesn't
server any static file anyway.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
We don't want prompts when running tests, especially when they are run
through tox and most likely on a CI server.
When cancelling a test mid-way, the test db is not destroyed ans
subsequent runs will fail trying to create it and asking the user what
to do. --noinput will use the default answer, that is to destroy the
test db and start anew.
v2: Rebase on top of upstream
v3: Rebase, yet again.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com> (v2)
Damien Lespiau [Mon, 24 Aug 2015 16:54:08 +0000 (17:54 +0100)]
filters: Fix submitter display when we only have an email address
I'm fairly sure I fixed that already, but here we go again. It's totally
valid to only have an email address for the submitter, so handle that
case properly.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Damien Lespiau [Mon, 24 Aug 2015 16:49:52 +0000 (17:49 +0100)]
filters: Submit the form when <Enter> is pressed on a closed submitter field
<Enter> when an element of the form is focused should submit the form.
Before this patch, when <Enter> was pressed on the submitter button,
nothing would happen.
So, we tweak our <Enter> handling on the submitter input a bit more:
<Enter> can be used to select the submitter from the autocompletion
list, but, when pressed a second time (ie. when the autocompletion
option has be selected and the dropdown isn't shown), we submit the
form.
Damien Lespiau [Mon, 24 Aug 2015 16:27:49 +0000 (17:27 +0100)]
filter: Tweak the autocompletion behaviour on <Enter>
No patch has landed yet and we've already had feedback from users (which
is a good thing!) that didn't want to lose the "quick" submitter search
by just typing a string and pressing <Enter> without having to wait for
the autocompletion to finish.
This will also make <Enter> do something useful for input strings that
have fewer than 4 characters, the autocompletion query only triggers
after that.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Damien Lespiau [Fri, 21 Aug 2015 15:04:03 +0000 (16:04 +0100)]
patch-list: Use table-condensed to display the patch list
Wolfram didn't like the fact we're now seeing far fewer patches on a
single page. That sounds fair enough and the table-condensed bootstrap
class removes some padding, hopefully making it better.
Suggested-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Damien Lespiau [Sat, 1 Nov 2014 19:01:50 +0000 (19:01 +0000)]
patch: Single out the commit message
All 'Comments' are stored the same way in the db, but I believe it's
worth making the distinction between introducing what the patch does and
eventual review comments.
v3: Fix docstrings
v2: Use two new Patch methods to retrieve the commit message and the
other comments (called answers here) (Jeremy Kerr)
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
filters: Rewrite the submitter autocompletion code
We now have a nice(r) autocompletion widget that will popup the list of
options directly underneath the input fild. A few changes are done in
this commit that couldn't be split any further:
- Use jQuery's $.ajax() for the completion query
- Use the application/json content type on the completion answer to
allow jQuery to directly create an object from it instead of giving
back a string (because of the text/plain content type)
- Crafted more logical objects in the json answer ie all properties are
at the same level instead of the default queryset serializer that put
the object fields in a 'field' sub-object.
- Use selectize.js for the autocompletion widget logic
A slight change in behaviour is that we now don't allow "free form"
submitter search, ie we need a valid completion to search with that
specific person (through its primary key). I didn't remove the backend
logic that allows the "free form" mechanism, but maybe we should.
v2: Squash the unit tests fixes into this patch (Jeremy Kerr)
Turns out, it's somewhat hard to do a nice auto-completion widget and
I'd like to get replace the input field + combo box that is currently
there. So import a library that will take care of the heavy lifting for
us.
Bootstrap called what was the header bar "navigation". Let's rename the
nav* selector with 'breadcrumb' so there's no confusion with bootstrap's
nagivation elements and selectors.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
So we can have a somewhat of a hierarchical progression:
All projects -> $project patches -> patch name
That should also help when we add series, we'll be able to just add the
series in there.
By default, we have:
All projects -> $project patches
both being links, so we can return to the list of patches from any page
where the project is defined. The '$project patches' link becomes
insensitive in the list page. Finally the patch page adds the patch at
the end.
This is part of the steps needed to make the "nav" bar into a pure
breadcrumb trail. It's quite usual these days to have "about" style
links at the bottom of pages.
Let's use HTML5 <nav> and bootstrap navigation facilities for this.
Among the nice things that bootstrap brings to the table, the navigation
bar is now mobile friendly: it will collapse when either, being
displayed on a mobile device or when the screen isn't wide enough, to
show the various items in a togglable menu. This can be tested by
resizing the browser to have a width < 768px.
This commit is just about layout changes, keeping the exact same
information displayed on the page.
This is based on work from Belén Barros Peña, but transposed to
bootstrap.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Django can send emails to admins on 500 HTTP errors when DEBUG is false.
That looks handy. That mechanism uses SERVER_EMAIL for the From:
address, which defaults to root@localhost and can cause problems in the
email delivery.
Use the same address than DEFAULT_FROM_EMAIL by default.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Brian Norris [Sun, 23 Nov 2014 06:30:06 +0000 (22:30 -0800)]
views: patch-list: show the 'Properties' update box for all users
Any authenticated user should be able to change the properties of their
own patches from the list view. They can already do so from the patch
view and from pwclient.
Now, authenticated users can perform 'Change state', 'Delegate to', and
'Archive' operations on multiple patches at a time (e.g., after
'select-all' on a bundle, or after selecting a few patches
individually). We'll print an error message to the page for any patches
which can't be updated (e.g., due to ownership).
This fixes a usability issue that has been reported a few times.
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Damien Lespiau [Fri, 9 Oct 2015 10:22:54 +0000 (11:22 +0100)]
parsemail: Don't catch exceptions when saving patches and comments
We'd like to know when those operations fail in production so we can at
least inspect what happened through the email send to settings.ADMINS in
main().
Catching those exceptions early prevents that.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Sat, 10 Oct 2015 03:05:27 +0000 (04:05 +0100)]
docs: Add basic API guide
Because it is now possible to access the auto-generated XML-RPC
documentation, only provide a brief "HOWTO" on using the 'xmlrpclib'
library and a note on how to find this autogenerated documentation.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Mon, 12 Oct 2015 17:01:55 +0000 (12:01 -0500)]
views/xmlrpc: Add serialization documentation
Add some documentation for the XML-RPC serializers, including examples.
This will help developers understand exactly what the API *should* be
returning for each given method.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Mon, 12 Oct 2015 16:20:10 +0000 (11:20 -0500)]
views/xmlrpc: Add documentation for API methods
This will be useful for populating the XML-RPC API documentation.
Note that this uses the Google-style docstring format. This format is
easier to read than the information-dense, "classic" Sphinx docstring
format making it more suitable for use with pydoc (which does not do
any post-processing and it used by the 'DocXMLRPCServer' module). If
generating documentation using Sphinx, this will require the usage of
the 'sphinx.ext.napoleon' extension.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Sat, 10 Oct 2015 02:50:53 +0000 (03:50 +0100)]
views/xmlrpc: Add xmlrpc automatic documentation
The DocXMLRPCServer module (standard library) provides documentation
for XML-RPC dispatchers via pydoc. Use this module rather than
reinventing the wheel.
Also update a test that no longer makes sense (the GET method now
retrieves documentation - it shouldn't redirect. Use PATCH instead).
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Damien Lespiau [Thu, 1 Oct 2015 11:35:20 +0000 (12:35 +0100)]
parsemail: Mail error information to ADMINS when parsing fails
We can use the built-in mechanism from django to send error emails when
failing to parse a mail. The error mails will have contain the full
guitly mail and the corresponding backtrace for debugging purposes.
v2: Add 2 PEP8 blank lines (Stephen Finucane)
v3: Remove one blank line (Stephen Finucane)
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Fri, 16 Oct 2015 19:29:53 +0000 (20:29 +0100)]
doc: Add CHANGELOG and UPGRADING docs
The CHANGELOG document should describe the high level changes of the
project. This will provide a human-readable way for people to evaluate
the changes in each release. This file is based on the templates and
general changelog "ethos" provided by 'Keep a CHANGELOG':
http://keepachangelog.com/
The UPGRADING document provide instruction for system admininstrators
managing patchwork deployments. At the moment, this document is a
rename and minor reformatting of the existing 'docs/NEWS' document, but
going forward documentation will be added for each new release.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>