aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* docs: Document the various htdocs supportedStephen Finucane2017-06-14
| | | | Signed-off-by: Stephen Finucane <stephen@that.guru>
* docs: Document how to access SQL consoleStephen Finucane2017-06-14
| | | | Signed-off-by: Stephen Finucane <stephen@that.guru>
* migrations: Mark '0016_series_project' as non-atomicStephen Finucane2017-06-14
| | | | | | | | | This should resolve migration issues arising from PostgreSQL's inability to mix data and schema migrations in a single transaction. Signed-off-by: Stephen Finucane <stephen@that.guru> Acked-by: Aaron Conole <aconole@bytheb.org> Closes-bug: #104
* Fix typo in 'bundles' templateStephen Finucane2017-06-09
| | | | Fixes: d1c605f ("views: Stop using Bundle.public_url")
* docs: Fix prelude for 2.0.0Stephen Finucane2017-05-30
| | | | | | | Turns out 'prelude' sections can't be lists. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: dd72ff6 ("docs: Add prelude section for v2.0.0")
* Add missing release for pwclient unicode fixesStephen Finucane2017-05-30
| | | | | | This was missed in '5e3b234'. Signed-off-by: Stephen Finucane <stephen@that.guru>
* docs: Add prelude section for v2.0.0Stephen Finucane2017-05-30
| | | | | | | Call out the two most important features in this release: the REST API and series/cover letter support. Signed-off-by: Stephen Finucane <stephen@that.guru>
* views: Display correct download links for coversStephen Finucane2017-05-30
| | | | | | | This means using the correct link for the cover mbox and not displaying one for the non-existent diff. Signed-off-by: Stephen Finucane <stephen@that.guru>
* REST: Expose cover mbox link via REST APIStephen Finucane2017-05-30
| | | | Signed-off-by: Stephen Finucane <stephen@that.guru>
* views: Enable downloading of cover mboxesStephen Finucane2017-05-30
| | | | Signed-off-by: Stephen Finucane <stephen@that.guru>
* models: Centralize generation of filenamesStephen Finucane2017-05-30
| | | | | | | | | | | Move filename generation to a mixin. This allows us to reuse the code for other items like cover letters. Some unncessary 'strip' calls are removed as their unnecessary. This allows us to change the file extension for diffs to 'diff', which is a little more accurate. Signed-off-by: Stephen Finucane <stephen@that.guru>
* parser: Validate deep threading behaviorStephen Finucane2017-05-30
| | | | | | This is pretty simple but let's add this to prevent regressions. Signed-off-by: Stephen Finucane <stephen@that.guru>
* parser: Handle multiple reference headersStephen Finucane2017-05-30
| | | | | | | | | | | | It's possible to duplicate message headers multiple times. One common case is the 'Received' header, but it appears that multiple 'In-Reply-To' and 'References' headers are also a thing. Handle these cases through the use of the 'Message.get_all' function, which returns all matching headers, instead of the 'Message.get' function previously used. Signed-off-by: Stephen Finucane <stephen@that.guru>
* parser: Strip whitespace from referencesStephen Finucane2017-05-30
| | | | | | | | | | Some mail, particularly those generated with older versions of git-send-email or written by hand, include some extra whitespace in the 'References' and 'In-Reply-To' lines. Ensure we always strip this, preventing mismatches between this and 'Message-ID', which is already stripped of whitespace, when looking up SeriesReference's. Signed-off-by: Stephen Finucane <stephen@that.guru>
* parser: Extend series heuristics to include other metadataStephen Finucane2017-05-30
| | | | | | | | | | | | | Not every series will include the reference headers necessary to do proper series-ification, particularly those generated without the help of 'git-send-email' or similar. Make life a little easier for these folks by attempting to match on other heuristics of the series: submitter, version, number of patches, project (mailing list) and date. The last of these is particularly important to prevent duplicate series getting munged together. Signed-off-by: Stephen Finucane <stephen@that.guru>
* docs: Document the various management commands availableStephen Finucane2017-05-30
| | | | | | | | As requested. Signed-off-by: Stephen Finucane <stephen@that.guru> Reported-by: Thomas Monjalon <thomas@monjalon.net> Closes-bug: #77
* docs/api: change POST to PATCH in REST API parameters exampleAndrew Donnellan2017-05-26
| | | | | | | | | api/rest.rst gives an example of how to POST parameters to the PatchDetail view at api/patches/<patch_id>. However, the endpoint in question doesn't support POST - you need to use PUT or PATCH. Change it to PATCH. Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* tests: Add tests for viewing private bundlesAndrew Donnellan2017-05-26
| | | | | | | | Add some tests to check that owners can view their private bundles while other authenticated users can't. Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Stephen Finucane <stephen@that.guru>
* bundle: Fix use of basic auth for bundle mboxesAndrew Donnellan2017-05-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 0b4f508a8438 ("views: Allow use of basic auth for bundle mboxes") added support for using Django REST Framework's BasicAuthentication to authenticate when accessing the bundle-mbox view. To check the user's credentials, we call BasicAuthentication.authenticate(), however, we don't check whether the returned user is actually the bundle owner. This means that any user can access any private bundle if they authenticate using basic authentication. Additionally, if invalid credentials are provided via a basic authentication header, BasicAuthentication.authenticate() will throw an AuthenticationFailed exception. We currently don't catch this, resulting in an exception page being displayed rather than a 404. Add a new helper, rest_auth(), that takes a request and returns a user. Call this in bundle_mbox() and save the result into request.user before we check whether request.user is actually the bundle owner. Found by code inspection. Fixes: 0b4f508a8438 ("views: Allow use of basic auth for bundle mboxes") Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* docker: increase database connection timeoutAndrew Donnellan2017-05-26
| | | | | | | | | | | | | | | When starting the Docker environment, if the web container can't see the database immediately, it waits 5 seconds, tries again, then waits 15 seconds more to account for first-time start-ups where it takes a bit longer for the database to be initialised. Some of us, unfortunately, have slow computers with slow mechanical hard drives which take just a bit longer. Increase the second timeout from 15 seconds to 60 seconds, testing every 5 seconds. Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Acked-by: Daniel Axtens <dja@axtens.net> Reviewed-by: Stephen Finucane <stephen@that.guru>
* docs: Correct pre-release regexStephen Finucane2017-05-26
| | | | | | | There's no dot before the rc version. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: b02c43d ("docs: Add pre-release regex")
* pwclient: Force xmlrpc client to return unicode stringsRobin Jarry2017-05-24
| | | | | | | | | | | | | | | | | | | | | On python 2, the reference implementation of the XML-RPC unmarshaller decodes strings to unicode with the selected encoding (utf-8 by default) but it tries to re-encode the unicode strings to ascii bytes before returning the values. If it fails, it leaves the value as unicode. See these links for more details: https://hg.python.org/cpython/file/2.7/Lib/xmlrpclib.py#l878 https://hg.python.org/cpython/file/2.7/Lib/xmlrpclib.py#l180 https://hg.python.org/cpython/file/3.6/Lib/xmlrpc/client.py#l753 Monkey-patch the internal xmlrpclib._stringify() function only on python 2 to force it to preserve unicode strings. This allows to have similar behaviour in both python 2 and python 3. Signed-off-by: Robin Jarry <robin.jarry@6wind.com> Signed-off-by: Stephen Finucane <stephen@that.guru>
* REST: Allow filtering by both project ID and linknameStephen Finucane2017-05-18
| | | | | | | | In hindsight, it's a bit odd that we would filter project by linkname by everything else by ID. Simply support both. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: e27b68a ("REST: Filter on Project.linkname - not Project.pk")
* Update django-debug-toolbar from 1.7 to 1.8pyup-bot2017-05-18
| | | | Reviewed-by: Stephen Finucane <stephen@that.guru>
* tox: Don't use exceptions - just warnStephen Finucane2017-05-18
| | | | | | | | It seems Django uses deprecated items in Python 3.x, meaning we can't use this. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 9db5cd0 ("tox: Turn deprecation notices into warnings")
* templates: Use compat.cycle everywhereStephen Finucane2017-05-18
| | | | | | | We missed this previously and now it's breaking Django 1.6. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 8ae7705 ("templates: Resolve cycle issues with Django 1.10")
* settings: 'XViewMiddleware' is moved in Django 1.6 tooStephen Finucane2017-05-18
| | | | | | | | This was causing a deprecation warning. Clearly we don't need to special case Django 1.6 here. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 9db5cd0 ("tox: Turn deprecation notices into warnings")
* models: Only set 'base_manager_name' for Django >= 1.10Stephen Finucane2017-05-18
| | | | | Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 8585ea5 ("models: Use 'base_manager_name'")
* settings: Enable 'XFrameOptionsMiddleware'Stephen Finucane2017-05-18
| | | | | | | This provides basic click jacking protection. This was identified using 'manage.py check --deploy'. Signed-off-by: Stephen Finucane <stephen@that.guru>
* REST: Resolve issues with filtersStephen Finucane2017-05-18
| | | | | | | | | | | | | | | Turns out filtering patches using a series string wasn't as easy as we thought. We need to slugify State.name, but unfortunately that isn't stored in the database. The tests were hiding this fact as State objects created by 'tests.utils.create_state' don't have spaces in them. Override custom versions of both django-filter's 'Filter' class and the Django 'Form' required by this, and update the tests to prevent a regression. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 6222574 ("REST: filter patches by state name") Tested-by: Philippe Pepiot <philippe.pepiot@logilab.fr>
* REST: Filter on Project.linkname - not Project.pkStephen Finucane2017-05-18
| | | | | | This is what we expect based on the web UI. Signed-off-by: Stephen Finucane <stephen@that.guru>
* REST: Embed nested element bodies instead of URLsStephen Finucane2017-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In developing a client for the Patchwork REST API, git-pw, it was noted that it should be possible to embed some information about nested resources in order to prevent the need for additional requests [1]. It was seen that this would be particularly beneficial for list operations, where each element in the N sized list could theoretically require an additional request for each of the M nested fields, resulting in N * (M + 1) total requests. Upon experimenting with the 2.0 RC1 API, this optimization was found to be less of a nice-to-have (and possibly something for the 2.1 release) and more of a must-have, particularly once one took network latency for each request into account. During testing with 'git-pw', simple list operations were found to take an average of 31 requests per operation, of which only one for was the resource endpoint itself ('GET /api/series'). As each of these requests took ~2 seconds a piece, listing was essentially broken. While local caching could be used to offset some of this demand, this will result in (a) significantly larger, more complex clients or (b) instances that strain under the load of dumb clients making multiple requests per operation. Instead, the server should be smarter about embedding the data that would actually be required by clients. Resolve the issue by embedding summarized versions of various nested fields instead of merely linking to them. Nesting is only a single level deep, to avoid large/complex database queries and with the expectation that only these basic fields (resource names, dates, etc.) would be required. These summary serializers are kept in their own module, to encourage consistent results throughout the API and to prevent circular import errors. This will have the side effect of slightly increasing load on the server due to the additional serialization required. However, this load is largely mitigated through the avoidance of deeper nesting as noted above. In addition, any increase in load seen will be a fraction of the demand that repeat requests will incur. While it would be possible to make nesting optional (by way of an 'embed' or 'expand' parameter), it is expected that this would be an atypical request and would result in far more complicated serialization code. [1] https://github.com/stephenfin/git-pw/blob/21e0e593/git_pw/patch.py#L88-L89 Signed-off-by: Stephen Finucane <stephen@that.guru>
* REST: Embed 'mbox' parameter in /seriesStephen Finucane2017-05-18
| | | | | | | This wasn't added in '6deedfb7' but it should have been. Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: 6deedfb7 ("views: Expose Series mbox")
* REST: Stop including 'tags' in '/patches'Stephen Finucane2017-05-18
| | | | | | | | | While this is a very helpful field to include, doing so significantly increases the number of DB queries necessary for listing patches (from ~14 to ~46). Stop including this information until the model itself is reworked to prevent this issue. Signed-off-by: Stephen Finucane <stephen@that.guru>
* REST: Correct some prefetch, select_relatedStephen Finucane2017-05-18
| | | | | | | | | | | | | | | | There were two issues here: - The 'get_queryset' function, rather than the 'queryset' attribute, must be overriden when using either the 'prefetch_related' or 'select_related' functions - A couple of endpoints contained a 'project' attribute, but this wasn't being prefetched. This didn't cause issues in a single-project deployment, as used in testing, but will for larger deployments Resolve both issues. Signed-off-by: Stephen Finucane <stephen@that.guru>
* tox: Turn deprecation notices into warningsStephen Finucane2017-05-18
| | | | | | | | | | | Django does an excellent job of marking what features are going to change in upcoming releases through extensive use of the 'warnings' module. Pass the '-Werror' flag to 'manage.py' in tests, ensuring that any warnings will result in exceptions instead. This should make upgrades a mostly painless process going forward. Signed-off-by: Stephen Finucane <stephen@that.guru>
* compat: Handle is_authenticated move to propertyStephen Finucane2017-05-18
| | | | | | | | This raises a warning in Django 1.10 and will cause an error in 2.0. This resolves all issues with Django 1.9. Signed-off-by: Stephen Finucane <stephen@that.guru>
* settings: Use 'MIDDLEWARE' for Django >= 1.10Stephen Finucane2017-05-18
| | | | | | This raises warnings in Django 1.10 and will be mandatory in Django 2.0. 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>
* models: Use 'base_manager_name'Stephen Finucane2017-05-18
| | | | | | | | | This raises warnings in Django 1.10 and will be required in Django 1.11. We also set 'silence_use_for_related_fields_deprecation' to allow us to retain the current behavior on versions of Django < 1.10. Signed-off-by: Stephen Finucane <stephen@that.guru>
* urls: Don't "include" admin URLsStephen Finucane2017-05-18
| | | | | | | | | | | | | This raises a warning in Django 1.9 and will cause an error in Django 2.0. Per the documentation [1] it is not even necessary so it can simply be removed. This resolves all issues with Django 1.9. [1] https://docs.djangoproject.com/en/1.11/ref/contrib/admin/\ #hooking-adminsite-instances-into-your-urlconf Signed-off-by: Stephen Finucane <stephen@that.guru>
* migrations: Explicitly set 'on_delete'Stephen Finucane2017-05-18
| | | | | | This raises warnings for Django 1.9 and will be mandatory in Django 2.0. Signed-off-by: Stephen Finucane <stephen@that.guru>
* models: Explicitly set 'on_delete'Stephen Finucane2017-05-18
| | | | | | This raises warnings in Django 1.9 and will be mandatory in Django 2.0. Signed-off-by: Stephen Finucane <stephen@that.guru>
* settings: Enable 'SessionAuthenticationMiddleware'Stephen Finucane2017-05-18
| | | | | | | | | | This raises warnings for Django 1.8 and is mandatory in Django 1.10. It provides a helpful feature, invalidating a user's session when their password is changed, and can/should be enabled. This resolves all issues with Django 1.8. Signed-off-by: Stephen Finucane <stephen@that.guru>
* docs: Don't mention 'default_project' in deployment guideStephen Finucane2017-05-18
| | | | | | | | | | | | | The deployment guide currently suggests using the 'default_project' fixture when deploying a production installation of Patchwork. While one _could_ use this, it's generally unnecessary given that most people care about their own projects and not Patchwork. Resolve this by simply removing any references. The references are retained for the development installation guide, as they're likely useful here. Signed-off-by: Stephen Finucane <stephen@that.guru>
* lib/apache2: Update location to wsgi python scriptFlorian Fainelli2017-05-15
| | | | | | | | | | | Commit 8fe68d96f18e ("wsgi: Move wsgi file to expected location") relocated lib/apache2/patchwork.wsgi to patchwork/wsgi.py but did not update the Apache2 example configuration file under lib/apache2/patchwork.wsgi.conf. Fixes: 8fe68d96f18e ("wsgi: Move wsgi file to expected location") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Stephen Finucane <stephen@that.guru>
* docs: Document Check.context type changeStephen Finucane2017-05-10
| | | | | | Check contexts must now be slugs. Document this in the release notes. Signed-off-by: Stephen Finucane <stephen@that.guru>
* settings: Enable the REST API by defaultStephen Finucane2017-05-04
| | | | | | | The release notes say this is already the case. As the API is now functionally complete, there's no reason not to toggle this. Make it so. Signed-off-by: Stephen Finucane <stephen@that.guru>
* lib: Correct typo in uWSGI config fileStephen Finucane2017-05-04
| | | | | | Signed-off-by: Stephen Finucane <stephen@that.guru> Reported-by: Philippe Pepiot <philippe.pepiot@logilab.fr> Fixes: 150f6150 ("lib: Update uWSGI, nginx config files")
* tox: Always recreate docsStephen Finucane2017-05-04
| | | | | | | The reno extension doesn't seem to trigger an environment rebuild. Force this. Signed-off-by: Stephen Finucane <stephen@that.guru>