]> git.ipfire.org Git - thirdparty/patchwork.git/log
thirdparty/patchwork.git
9 years agoparser: fix wrong parsing of diff comments
WEN Pingbo [Mon, 5 Sep 2016 14:31:46 +0000 (22:31 +0800)] 
parser: fix wrong parsing of diff comments

If the subject of a submission is prefixed by 'Re:', then it can't be a
patch or cover letter.

Signed-off-by: WEN Pingbo <wengpingbo@gmail.com>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoAdd sqlparse to production requirements
Daniel Axtens [Tue, 20 Sep 2016 06:04:20 +0000 (16:04 +1000)] 
Add sqlparse to production requirements

It's required for migration #10 (w/ RunSQL), per upstream docs:

    https://docs.djangoproject.com/en/1.8/ref/migration-operations/#runsql

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agobin: Remove update-patchwork-status
Stephen Finucane [Fri, 9 Sep 2016 17:27:46 +0000 (18:27 +0100)] 
bin: Remove update-patchwork-status

If this ever did anything then it no longer does. Remove it.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoCHANGELOG: Document latest changes
Stephen Finucane [Wed, 14 Sep 2016 17:18:52 +0000 (18:18 +0100)] 
CHANGELOG: Document latest changes

...in prep for v2.0.0.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoCHANGELOG: Add v1.1.1 release
Stephen Finucane [Wed, 14 Sep 2016 16:51:22 +0000 (17:51 +0100)] 
CHANGELOG: Add v1.1.1 release

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoCHANGELOG: Integrate UPGRADING content
Stephen Finucane [Wed, 14 Sep 2016 16:43:02 +0000 (17:43 +0100)] 
CHANGELOG: Integrate UPGRADING content

Rewrite the CHANGELOG as necessary, making better use of the
'UPGRADING' section

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agotrivial: Fix incorrectly subclassed 'save's
Stephen Finucane [Fri, 9 Sep 2016 16:23:53 +0000 (17:23 +0100)] 
trivial: Fix incorrectly subclassed 'save's

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agotrivial: Remove unreachable code
Stephen Finucane [Fri, 9 Sep 2016 16:20:58 +0000 (17:20 +0100)] 
trivial: Remove unreachable code

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agotrivial: noqa unused imports
Stephen Finucane [Fri, 9 Sep 2016 16:19:51 +0000 (17:19 +0100)] 
trivial: noqa unused imports

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agotrivial: Combine if statements
Stephen Finucane [Fri, 9 Sep 2016 16:19:30 +0000 (17:19 +0100)] 
trivial: Combine if statements

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agotrivial: Use 'in' operator
Stephen Finucane [Fri, 9 Sep 2016 16:02:58 +0000 (17:02 +0100)] 
trivial: Use 'in' operator

Don't do 'x == a or x == b'. Prefer 'x in [a, b]' instead.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agotrivial: Don't use non-Pythonic names
Stephen Finucane [Fri, 9 Sep 2016 16:00:51 +0000 (17:00 +0100)] 
trivial: Don't use non-Pythonic names

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agotrivial: Use implicit true/false for comparison
Stephen Finucane [Mon, 19 Sep 2016 22:15:38 +0000 (23:15 +0100)] 
trivial: Use implicit true/false for comparison

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agotrivial: noqa any 'assert' functions
Stephen Finucane [Mon, 19 Sep 2016 22:15:26 +0000 (23:15 +0100)] 
trivial: noqa any 'assert' functions

There are advantages to sticking with unittest's use of camel case in
function names, but some code tools don't like this. noqa these lines
to hide the warnings.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agotrivial: Remove broad exceptions where possible
Stephen Finucane [Thu, 8 Sep 2016 16:43:10 +0000 (17:43 +0100)] 
trivial: Remove broad exceptions where possible

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>
9 years agotrivial: Don't shadow built-ins
Stephen Finucane [Mon, 19 Sep 2016 22:15:14 +0000 (23:15 +0100)] 
trivial: Don't shadow built-ins

* 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>
9 years agoviews: Remove cyclic import
Stephen Finucane [Mon, 19 Sep 2016 22:15:01 +0000 (23:15 +0100)] 
views: Remove cyclic import

There's no need to do imports this way, so move notification handling
into a suitable module.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agoxmlrpc: Bump version
Stephen Finucane [Thu, 8 Sep 2016 16:28:17 +0000 (17:28 +0100)] 
xmlrpc: Bump version

This should have been bumped with 'c547dc7'.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agoxmlrpc: Factor out common code
Stephen Finucane [Thu, 8 Sep 2016 16:26:30 +0000 (17:26 +0100)] 
xmlrpc: Factor out common code

Now that every endpoint accepts negative max_counts, the code that does
this can be factored out.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agogitignore: Ignore vagrant and vim files
Stephen Finucane [Mon, 19 Sep 2016 22:11:54 +0000 (23:11 +0100)] 
gitignore: Ignore vagrant and vim files

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoOptimise querying of checks in patch list view
Daniel Axtens [Thu, 15 Sep 2016 08:10:29 +0000 (18:10 +1000)] 
Optimise querying of checks in patch list view

tl;dr: with about 300 mails from the patchwork list, according to
django-debug-toolbar, to render '/project/patchwork/list/'

Without this patch:
 - ~1.35 seconds of CPU time
 - 110 SQL queries, taking ~70ms

With this patch:
 - < 0.3 seconds of CPU time
 - 10 SQL queries, taking <20ms

How? Replace an .exclude() on a QuerySet with a list comprehension.
Yes, that's normally a pessimisation.  Surprisingly, it's an
optimisation here.  Why? Where we're looking at patches in anything
that uses a generic_list() in the view, we do a prefetch_related. But,
if we then do a .filter or a .exclude, that throws out the existing,
cached information, and does another query. (See the Django docs on
prefetch_related)

So, do it 'by hand' in Python instead.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agofields: Stub out unused arguments
Stephen Finucane [Wed, 7 Sep 2016 21:03:49 +0000 (22:03 +0100)] 
fields: Stub out unused arguments

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agosettings: noqa the secret key
Stephen Finucane [Wed, 7 Sep 2016 21:03:48 +0000 (22:03 +0100)] 
settings: noqa the secret key

This is a development setting file. Dismiss the 'dodgy' warning on
landscape.io.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoMark regexes with 'r' prefixes
Stephen Finucane [Wed, 7 Sep 2016 21:03:47 +0000 (22:03 +0100)] 
Mark regexes with 'r' prefixes

Resolves landscape.io errors.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agodocker: Install dependencies for Python 2 also
Stephen Finucane [Sat, 3 Sep 2016 17:49:02 +0000 (18:49 +0100)] 
docker: Install dependencies for Python 2 also

Aspects of both Patchwork and Django, such as the 'makemigrations'
management command, function differently under Python 3. It should be
possible to run these commands under Python 2. Install dependencies in
the Python 2 environment to make this a possibility.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Acked-by: Daniel Axtens <dja@axtens.net>
9 years agoREADME: Add travis badge
Stephen Finucane [Wed, 7 Sep 2016 21:06:08 +0000 (22:06 +0100)] 
README: Add travis badge

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agoAdd .travis.yml file
Daniel Axtens [Tue, 9 Aug 2016 04:27:41 +0000 (14:27 +1000)] 
Add .travis.yml file

This automatically runs the tests (except the browser ones) via tox.

Tested on my github account. This will require some setup on the GitHub
end: Travis will need to be turned on for the project, and ideally a
badge added to the readme so we can see the build status.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoutils: Rename to 'notifications'
Stephen Finucane [Mon, 22 Aug 2016 14:06:48 +0000 (15:06 +0100)] 
utils: Rename to 'notifications'

Every function in this file is related to notifications. Rename the
file and functions therein to something more meaningful.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoREADME: Add landscape.io badge
Stephen Finucane [Sun, 4 Sep 2016 14:19:05 +0000 (15:19 +0100)] 
README: Add landscape.io badge

Also partially reverts 'a93f5ec' as badge images are still served from
the '.org' domain.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoAdd landscape.io configuration file
Stephen Finucane [Sun, 4 Sep 2016 14:12:53 +0000 (15:12 +0100)] 
Add landscape.io configuration file

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agogitignore: Don't ignore all hidden files
Stephen Finucane [Sun, 4 Sep 2016 14:12:12 +0000 (15:12 +0100)] 
gitignore: Don't ignore all hidden files

This allows the addition of some config files.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoviews: Avoid mutable default arguments
Stephen Finucane [Sun, 4 Sep 2016 00:29:01 +0000 (01:29 +0100)] 
views: Avoid mutable default arguments

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agolib: Refresh nginx/uwsgi configuration
Thomas Monjalon [Tue, 6 Sep 2016 20:37:03 +0000 (22:37 +0200)] 
lib: Refresh nginx/uwsgi configuration

As stated in http://uwsgi-docs.readthedocs.io/en/latest/Nginx.html:
"
Unfortunately nginx is not able to rewrite PATH_INFO accordingly to
SCRIPT_NAME. For such reason you need to instruct uWSGI to map specific
apps in the so called “mountpoint” and rewrite SCRIPT_NAME and PATH_INFO
automatically
[...]
ancient uWSGI versions used to support the so called “uwsgi_modifier1 30”
approach. Do not do it. it is a really ugly hack
"

Replacing the uwsgi_modifier1 hack by a mount point seems to work.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
9 years agotox: Don't create '.pyc' files
Stephen Finucane [Sat, 3 Sep 2016 19:18:02 +0000 (20:18 +0100)] 
tox: Don't create '.pyc' files

In '8e58c29', code was added to delete '.pyc' files. However, this was
later reverted in '9fd161' due to the increase in run time that this
incurred. However, the need to avoid stale '.pyc' files still exists.
To resolve this, add the 'PYTHONDONTWRITEBYTECODE' environment option
to disable generation of these files. This includes a slight
performance increase.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoviews: fix pwclient download link
David Lamparter [Tue, 26 Jul 2016 14:51:02 +0000 (16:51 +0200)] 
views: fix pwclient download link

Looks like a copypaste snafu.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoxmlrpc: massively increase test coverage
Daniel Axtens [Sat, 3 Sep 2016 07:07:20 +0000 (17:07 +1000)] 
xmlrpc: massively increase test coverage

XMLRPC defines a bunch of very similar methods for getting and
listing a bunch of different models. So create a mixin that allows
us to test an arbitrary model, then use that to create test classes
to test the various models.

Add other tests as well.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoxmlrpc authentication: Fix base64 decoding for py3
Daniel Axtens [Sat, 3 Sep 2016 07:07:19 +0000 (17:07 +1000)] 
xmlrpc authentication: Fix base64 decoding for py3

The byte/string distinction in Python 3 requires this messy set of
encode/decode to work.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoxmlrpc: remove a redundant try/except block
Daniel Axtens [Sat, 3 Sep 2016 07:07:18 +0000 (17:07 +1000)] 
xmlrpc: remove a redundant try/except block

The try block just raises the exception it catches, so just get rid of
it.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoxmlrpc: catch possible exceptions in patch filtering
Daniel Axtens [Sat, 3 Sep 2016 07:07:17 +0000 (17:07 +1000)] 
xmlrpc: catch possible exceptions in patch filtering

Currently, filtering by project, submitter, delegate or state uses a
filter(id=filt[key])[0]. This will throw an exception when something
isn't found, as filter will return [], and getting the first element of
that will fail.

Convert them to explicit get()s, so it's clearer that they can throw an
exception, then catch the 3 possible types of DoesNotExists exceptions.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoxmlrpc: remove some unnecessary try/except blocks
Daniel Axtens [Sat, 3 Sep 2016 07:07:16 +0000 (17:07 +1000)] 
xmlrpc: remove some unnecessary try/except blocks

filter() can never raise a DoesNotExist exception, so we don't need a
try/except block around these.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoxmlrpc: fix max_count for check_list
Daniel Axtens [Sat, 3 Sep 2016 07:07:15 +0000 (17:07 +1000)] 
xmlrpc: fix max_count for check_list

Negative values were broken due to some missing code. Fix it by adding
code based on an example from one of the other models.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoxmlrpc: Change filter(...)[0] to get(...)
Daniel Axtens [Sat, 3 Sep 2016 07:07:14 +0000 (17:07 +1000)] 
xmlrpc: Change filter(...)[0] to get(...)

filter() returns a list or [], and get() returns an object or raises an
exception.

Currently, we use filter()[0] inside a try/except model.DoesNotExist
block. This doesn't work: if filter returns [] we'll get an exception
about list indices, not a DoesNotExist exception.

Switch these over to get(), allowing them to use the existing exception
flow.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agotest: fix coverage tests
Daniel Axtens [Sat, 3 Sep 2016 07:07:13 +0000 (17:07 +1000)] 
test: fix coverage tests

* ignore migrations
 * install dev requirements, as the dev settings are used

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoparser: Correct empty email value check
Stephen Finucane [Mon, 18 Apr 2016 10:21:09 +0000 (11:21 +0100)] 
parser: Correct empty email value check

The check for empty emails in 'find_author' checked for None, but it
was not possible to ever return None unless the 'From:' header was
missing altogether. Seeing as, per RFC822 and its revisions, this is
not possible, check for the empty string instead.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Additional rework of 'test_parser'
Stephen Finucane [Tue, 12 Jul 2016 15:56:13 +0000 (16:56 +0100)] 
tests: Additional rework of 'test_parser'

The 'test_parser' file was reworked in 'e14a071'. Extend this rework to
include refactoring of tests related to 'find_author'.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agoparser: Ensure consistent use of 'parse_'
Stephen Finucane [Mon, 9 May 2016 12:34:02 +0000 (13:34 +0100)] 
parser: Ensure consistent use of 'parse_'

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agoparser: Put more specific 'From' regex first
Stephen Finucane [Thu, 14 Apr 2016 16:38:57 +0000 (17:38 +0100)] 
parser: Put more specific 'From' regex first

Multiple different 'From:' header styles are supported by the parser,
but some of these are less specific than others. Attempt to parse using
a more specific style before going with the more generic one.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agoparsemail: Move parsing to 'parser'
Stephen Finucane [Sun, 10 Apr 2016 12:45:13 +0000 (13:45 +0100)] 
parsemail: Move parsing to 'parser'

Separate the parsing of mails from the CLI aspects of parsemail. Since
there is already a 'parser' module, it makes sense to place the parsing
functionality here. This will allow for additional uses of this parsing
functionality in the future.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agoparser: Move hash_diff and extract_tags
Stephen Finucane [Tue, 12 Jul 2016 13:59:39 +0000 (14:59 +0100)] 
parser: Move hash_diff and extract_tags

These functions are only used in models.Patch. Add them as static
methods.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agoparser: Remove 'main' function
Stephen Finucane [Sun, 10 Apr 2016 14:05:17 +0000 (15:05 +0100)] 
parser: Remove 'main' function

This is unnecessary given the combination of parsemail and tests.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotrivial: Cleanup of 'parser'
Stephen Finucane [Sun, 10 Apr 2016 12:45:13 +0000 (13:45 +0100)] 
trivial: Cleanup of 'parser'

Do some cleanup of the file by removing excess whitespace, adding some
documentation, removing shadowing of keywords and renaming some
functions to more accurately reflect their purpose.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agoxmlrpc: Don't use 'reverse'
Stephen Finucane [Thu, 1 Sep 2016 19:57:09 +0000 (20:57 +0100)] 
xmlrpc: Don't use 'reverse'

queryset.reverse() is either broken or being used incorrectly in
Django 1.6 and Django 1.7. Replace it with an alternative approach.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Closes-bug: #35
Tested-by: Daniel Axtens <dja@axtens.net>
9 years agorequirements: Update django debug toolbar to 1.5
Stephen Finucane [Sun, 21 Aug 2016 17:06:55 +0000 (18:06 +0100)] 
requirements: Update django debug toolbar to 1.5

This is the latest version. This breaks compatibility with Django 1.7,
but this version is unsupported and should not be used for development.
We do, however, continue to test support for Django 1.7 and 1.6.

This also prevents the need to manually track sqlparse dependency [1].

[1] https://github.com/jazzband/django-debug-toolbar/issues/856

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agotox: Add Python 3.5
Daniel Axtens [Tue, 9 Aug 2016 04:55:23 +0000 (14:55 +1000)] 
tox: Add Python 3.5

Python 3.5 is shipped with Ubuntu 16.04, and it's the new stable
release. Add support for this runtime in tox. Note that Django 1.6 and
1.7 don't work with Python 3.5, so these are excluded.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agodocker: Install Python 3.4
Daniel Axtens [Fri, 26 Aug 2016 06:55:59 +0000 (16:55 +1000)] 
docker: Install Python 3.4

Currently, we tox test against Python 3.4. Python 3.4 is included with
Ubuntu 14.04, which is supported for several years to come, so we want
to keep supporting it. However, Python 3.4 isn't included with Ubuntu
16.04, which is what the Docker image is based on.

We could downgrade the container to 14.04, but then we'd struggle to
get Python 3.5 into the container. Python 3.5 is the most recent in the
Python 3 series, so we should also be supporting it.

Add the apt sources for Trusty and pull in Python 3.4 from there.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agodocs: Update readthedocs URLs
Stephen Finucane [Mon, 29 Aug 2016 23:35:41 +0000 (00:35 +0100)] 
docs: Update readthedocs URLs

'readthedocs.io' is preferred to 'readthedocs.org'. Update all relevant
links.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agodocs: Document SELinux issues
Stephen Finucane [Mon, 29 Aug 2016 23:35:40 +0000 (00:35 +0100)] 
docs: Document SELinux issues

Initial Docker setup caused me some heartache on Fedora. Briefly
document the issues encountered to help other users.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agodocs: Make Docker the recommended install method
Stephen Finucane [Mon, 29 Aug 2016 23:35:39 +0000 (00:35 +0100)] 
docs: Make Docker the recommended install method

Docker is faster, lighter and "hipper" than Vagrant. Promote this
method over the Vagrant approach.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
9 years agodocker: Move 'docker' directory to 'tools'
Stephen Finucane [Mon, 29 Aug 2016 23:35:38 +0000 (00:35 +0100)] 
docker: Move 'docker' directory to 'tools'

...like the Vagrant scripts (which have been renamed also).

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Acked-by: Daniel Axtens <dja@axtens.net>
9 years agodocs: Add a paragraph about the django admin console
Florian Fainelli [Tue, 30 Aug 2016 01:12:15 +0000 (18:12 -0700)] 
docs: Add a paragraph about the django admin console

Provide a few hints about how to get initial access to the django admin
console as well as a few essential configuration hints regarding
projects and sites setup.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agopwclient: Unhardcode prints to ~/.pwclientrc
Florian Fainelli [Tue, 30 Aug 2016 01:12:14 +0000 (18:12 -0700)] 
pwclient: Unhardcode prints to ~/.pwclientrc

Even though the default location is ~/.pwclientrc, we can change it, so
use CONFIG_FILE wherever we can to make the prints match the actual file
location.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agotox: Disable F405
Stephen Finucane [Sat, 13 Aug 2016 22:43:04 +0000 (23:43 +0100)] 
tox: Disable F405

Recent versions of tox throw a lot of errors when using star-imports.
While these warnings are generally justified, the settings files
require this. Since 'noqa'-ing the offending lines would be rather
arduous, simply disable the warning instead.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agotrivial: Resolve PEP8 isues
Stephen Finucane [Sun, 21 Aug 2016 16:27:28 +0000 (17:27 +0100)] 
trivial: Resolve PEP8 isues

These were introduced with recent commits.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoEnable tox tests in Docker
Daniel Axtens [Tue, 9 Aug 2016 04:55:24 +0000 (14:55 +1000)] 
Enable tox tests in Docker

Update the entrypoint script to allow you to do --tox and
--quick-tox in the same way as --test and --quick-test.
Update the readme appropriately.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoPass more environment variables through to tox
Daniel Axtens [Tue, 9 Aug 2016 04:55:22 +0000 (14:55 +1000)] 
Pass more environment variables through to tox

In order to get tox tests working, we want db host, db port, home,
and xauthority.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoDon't import the REST framework if it is disabled
Daniel Axtens [Tue, 9 Aug 2016 04:55:21 +0000 (14:55 +1000)] 
Don't import the REST framework if it is disabled

In the disabled case, also stub out the APITestCase class.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agosettings: only enable the REST framework for Django 1.7+
Daniel Axtens [Tue, 9 Aug 2016 04:55:20 +0000 (14:55 +1000)] 
settings: only enable the REST framework for Django 1.7+

This helps with tox tests for Django 1.6

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoConvert RunSQL migration commands from list to strings
Daniel Axtens [Tue, 9 Aug 2016 04:55:19 +0000 (14:55 +1000)] 
Convert RunSQL migration commands from list to strings

The ability to use a list was added in Django 1.8 - compare

https://docs.djangoproject.com/en/1.7/ref/migration-operations/#runsql
https://docs.djangoproject.com/en/1.8/ref/migration-operations/#runsql

We don't need a list as we run only 1 SQL command. So convert to
strings. This helps unbreak Django 1.7.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoAdd Docker IP to whitelist for django-debug-toolbar
Daniel Axtens [Tue, 9 Aug 2016 04:38:45 +0000 (14:38 +1000)] 
Add Docker IP to whitelist for django-debug-toolbar

Yay for debugging with Docker.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoAllow use of Docker for development
Daniel Axtens [Tue, 9 Aug 2016 04:27:40 +0000 (14:27 +1000)] 
Allow use of Docker for development

This makes it possible to use Docker and docker-compose for development
as an alternative to Vagrant.

I quite liked vagrant a couple of years ago, but currently:

 * Trying to install VirtualBox on Ubuntu wants me to disable
   Secure Boot, and I don't want to do that.

 * Trying to use the libvirt plugin for vagrant requires I pick
   from a very small set of possible images, and requires that I
   install the upstream vagrant rather than the vagrant shipped
   with Ubuntu 16.04

 * I find docker containers faster to work with and more transparent.

So I've done the work to make docker work for Patchwork development.
This doesn't break or in any way interfere with using Vagrant, it just
provides an alternative.

It includes support for headless selenium tests using Chromium.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoPut test db host and port into env variables
Daniel Axtens [Tue, 9 Aug 2016 04:27:39 +0000 (14:27 +1000)] 
Put test db host and port into env variables

This is preparation for a Docker-based dev environment.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoIgnore *~ and #*# files.
Daniel Axtens [Tue, 9 Aug 2016 04:27:38 +0000 (14:27 +1000)] 
Ignore *~ and #*# files.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoFix test_login in test_user_browser.py
Daniel Axtens [Tue, 9 Aug 2016 04:27:37 +0000 (14:27 +1000)] 
Fix test_login in test_user_browser.py

It tried to use the pbkdf2 hash as the password. Use the username instead, as that
is what create_user sets.

Then it compared the test user username to testuser, rather than the username, which
is dynamically generated. Compare to the generated username.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agoFix failure to start with uninitalised database
Daniel Axtens [Tue, 9 Aug 2016 04:27:36 +0000 (14:27 +1000)] 
Fix failure to start with uninitalised database

An OptionalModelChoiceField will attempt to query the database to get choices
in its __init__ method. This fails if the database hasn't been initialised
yet. So, put that in a try/catch block. This lets things work through the
migration and loading of data from fixtures.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
9 years agosettings: Add PASSWORD_HASHER
Stephen Finucane [Wed, 13 Jul 2016 22:25:25 +0000 (23:25 +0100)] 
settings: Add PASSWORD_HASHER

This improves run time by a few seconds, and is worth having.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Tested-by: Andy Doan <andy.doan@linaro.org>
9 years agosettings: Regroup sections per upstream docs
Stephen Finucane [Wed, 13 Jul 2016 22:25:24 +0000 (23:25 +0100)] 
settings: Regroup sections per upstream docs

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
9 years agodocs: Alter heading of development install guide
Stephen Finucane [Wed, 13 Jul 2016 09:41:00 +0000 (10:41 +0100)] 
docs: Alter heading of development install guide

Divide the document into a Vagrant-based install section, and a manual
install section (+ footnotes).

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agoxmlrpc: Don't load all Patches into memory
Stephen Finucane [Wed, 13 Jul 2016 09:57:29 +0000 (10:57 +0100)] 
xmlrpc: Don't load all Patches into memory

The way that reverse indexing of patches was implemented is broken.
At present, it will retrieve all patches in memory and return the
length from that data, then the slicing operation will then happen
without querying the DB and slice the results cached from the len()
evaluation. This is memory intensive, particularly for larger
instances.

Take advantage of Django's lazy loading to avoid this.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Suggested-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Address nits in 'utils'
Stephen Finucane [Fri, 15 Jul 2016 13:45:08 +0000 (14:45 +0100)] 
tests: Address nits in 'utils'

Simplify object creation through creation of the 'objects.create'
shortcut. In addition, remove an unncessary 'save' call.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agoparsemail: Ignore multiple cover letters
Russell Currey [Fri, 15 Jul 2016 06:29:10 +0000 (16:29 +1000)] 
parsemail: Ignore multiple cover letters

If multiple cover letters are found, parsemail dies with a
MultipleObjectsReturned exception.  This is particularly problematic in
the middle of a parsearchive run, so just ignore multiple cover letters.

Signed-off-by: Russell Currey <ruscur@russell.cc>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
9 years agouwsgi: Add python plugin
Russell Currey [Fri, 15 Jul 2016 05:42:09 +0000 (15:42 +1000)] 
uwsgi: Add python plugin

Given the documentation suggests using Ubuntu, and any Debian derivative
requires manually specifying plugins in uwsgi, add the python27 plugin to
the example uwsgi settings file.

Signed-off-by: Russell Currey <ruscur@russell.cc>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
9 years agodocs/deployment: Fix systemctl commands
Russell Currey [Fri, 15 Jul 2016 04:46:28 +0000 (14:46 +1000)] 
docs/deployment: Fix systemctl commands

systemctl takes the name of the operation before the name of the service
so that you can do multiple things at once, i.e. "systemctl status nginx
postgresql".  Fix the ordering of the arguments.

Signed-off-by: Russell Currey <ruscur@russell.cc>
Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
9 years agotests: Don't create model objects unless necessary
Stephen Finucane [Thu, 30 Jun 2016 17:30:27 +0000 (18:30 +0100)] 
tests: Don't create model objects unless necessary

Creating model objects when not required introduces unnecessary
overhead and delays the tests. Avoid this by only creating new objects
when one isn't provided for us already.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Remove 'default_states' fixture requirement
Stephen Finucane [Thu, 30 Jun 2016 17:30:26 +0000 (18:30 +0100)] 
tests: Remove 'default_states' fixture requirement

The 'default_states' fixture is used in many tests. However, the
'default_states' are merely suggestions for various States, and the
names themselves have no meaning from a patchwork perspective. In
addition, these fixtures significantly increase run time of the tests.

Resolve this by creating new State objects on demand, rather than
using versions provided by the fixture.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Remove 'defaults' class
Stephen Finucane [Thu, 30 Jun 2016 17:30:25 +0000 (18:30 +0100)] 
tests: Remove 'defaults' class

This is no longer needed and can be removed.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_rest_api'
Stephen Finucane [Thu, 30 Jun 2016 17:30:24 +0000 (18:30 +0100)] 
tests: Clean up 'test_rest_api'

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Move 'create_check' to utils
Stephen Finucane [Thu, 30 Jun 2016 17:30:23 +0000 (18:30 +0100)] 
tests: Move 'create_check' to utils

This is also useful for the REST API tests.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Rework and rename 'test_patchparser'
Stephen Finucane [Tue, 21 Jun 2016 21:20:10 +0000 (22:20 +0100)] 
tests: Rework and rename 'test_patchparser'

* Move some functions and variables from 'tests.utils', where they are
  only used in this file
* Rename and regroup some tests to make more sense
* Rename to 'test_parser', as this parses more than patches now

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_patchparser'
Stephen Finucane [Tue, 21 Jun 2016 20:45:06 +0000 (21:45 +0100)] 
tests: Clean up 'test_patchparser'

* Make use of 'create_' helper functions
* Include every import on its own line
* Use underscore_case, rather than camelCase
* Rename some functions to make more sense

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_xmlrpc'
Stephen Finucane [Tue, 21 Jun 2016 17:19:14 +0000 (18:19 +0100)] 
tests: Clean up 'test_xmlrpc'

* Use underscore_case, rather than camelCase

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_user_browser'
Stephen Finucane [Tue, 21 Jun 2016 17:16:28 +0000 (18:16 +0100)] 
tests: Clean up 'test_user_browser'

* Don't use hardcode routes: use the reverse function instead

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_user'
Stephen Finucane [Mon, 20 Jun 2016 10:43:32 +0000 (11:43 +0100)] 
tests: Clean up 'test_user'

* Don't use hardcode routes: use the reverse function instead
* Make use of 'create_' helper functions
* Minimize duplication of code
* Remove unneeded 'XXX.objects.delete()' calls (all objects are deleted
  on teardown of each test)
* Include every import on its own line
* Use underscore_case, rather than camelCase

This includes one trivial, albeit necessary, removal of an import from
'test_user_browser'.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_updates'
Stephen Finucane [Tue, 21 Jun 2016 17:04:56 +0000 (18:04 +0100)] 
tests: Clean up 'test_updates'

* Make use of 'create_' helper functions
* Include every import on its own line
* Use underscore_case, rather than camelCase
* Be consistent in how 'Patch.objects.get()' is called

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_tags'
Stephen Finucane [Tue, 21 Jun 2016 14:23:25 +0000 (15:23 +0100)] 
tests: Clean up 'test_tags'

* Make use of 'create_' helper functions
* Remove unneeded 'XXX.objects.delete()' calls (all objects are deleted
  on teardown of each test)
* Use underscore_case, rather than camelCase

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Rename 'test_person'
Stephen Finucane [Tue, 21 Jun 2016 13:46:07 +0000 (14:46 +0100)] 
tests: Rename 'test_person'

Reflect the purpose of these tests - validation of the autocomplete
feature - in the filename.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_person'
Stephen Finucane [Tue, 21 Jun 2016 10:13:41 +0000 (11:13 +0100)] 
tests: Clean up 'test_person'

* Don't use hardcode routes: use the reverse function instead
* Make use of 'create_' helper functions
* Include every import on its own line
* Use underscore_case, rather than camelCase

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_notifications'
Stephen Finucane [Tue, 21 Jun 2016 08:20:42 +0000 (09:20 +0100)] 
tests: Clean up 'test_notifications'

* Make use of 'create_' helper functions
* Remove unneeded 'XXX.objects.delete()' calls (all objects are deleted
  on teardown of each test)
* Include every import on its own line
* Use underscore_case, rather than camelCase

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_mboxviews'
Stephen Finucane [Mon, 20 Jun 2016 16:02:49 +0000 (17:02 +0100)] 
tests: Clean up 'test_mboxviews'

* Don't use hardcode routes: use the reverse function instead
* Make use of 'create_' helper functions
* Include every import on its own line
* Use underscore_case, rather than camelCase
* Rename and regroup some tests to make more sense

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_mail_settings'
Stephen Finucane [Mon, 20 Jun 2016 15:11:44 +0000 (16:11 +0100)] 
tests: Clean up 'test_mail_settings'

* Make use of 'create_' helper functions
* Include every import on its own line
* Use underscore_case, rather than camelCase
* Don't use class level variables when not required

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>
9 years agotests: Clean up 'test_list'
Stephen Finucane [Mon, 20 Jun 2016 14:39:14 +0000 (15:39 +0100)] 
tests: Clean up 'test_list'

* Make use of 'create_' helper functions
* Include every import on its own line
* Use underscore_case, rather than camelCase
* Don't use list comprehension without generating a list: use a for
  loop instead

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Reviewed-by: Andy Doan <andy.doan@linaro.org>