This will make editing states through the admin UI less error-prone, and
will facilitate parsing patches when relying on a default state, as well as
testing.
Use the explicit default state when parsing mails.
Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Thu, 8 Dec 2011 13:42:26 +0000 (21:42 +0800)]
filters: handle utf-8 characters when building filter querystring
Currently, we build the filter querystring by passing the raw string to
urllib.quote, which expects an encoded string. When the raw string (in
this case, a unicode object) contains a unicode character, quote()
raises a KeyError.
This fixes the problem by encoding the parameter name and values to
UTF-8 first.
Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
david decotigny [Tue, 22 Nov 2011 09:12:48 +0000 (09:12 +0000)]
patchwork: new pwclient git-am action
This commit adds a new "pwclient git-am" action which applies given
patch ID on the current git branch using "git am". It's convenient to
keep track and authorship of patches applied locally from a patchwork
server.
Signed-off-by: David Decotigny <david.decotigny@google.com>
Jeremy Kerr [Mon, 19 Sep 2011 02:33:51 +0000 (10:33 +0800)]
models: Update Person & UserProfile object whenever User is saved
Currently, UserProfiles are only saved on creation of the User object,
before the first_name and last_name attributes are set. This means that
we fallback to using the User.username value as the new Person.name.
This change modifies User's post-save signal to always update the Person
object, both on creation and updates. This means we get the proper name
appearing on Person instances.
Jeremy Kerr [Mon, 18 Jul 2011 13:46:08 +0000 (21:46 +0800)]
xmlrpc: do slice before patch_to_dict
Currently, we map patch_to_dict before we slice the results (to only
return max_count patches). This means that we hacve to retrieve all
patches, then throw away most of the results of the map.
This change does the slice on the patches before the map, letting django
do a LIMIT-ed query instead.
Jeremy Kerr [Tue, 19 Apr 2011 05:18:45 +0000 (13:18 +0800)]
settings: Use multiple-DB-style format for default settings
The DATABASE_* settings have been deprecated in django 1.3, replaced by
the multiple-database style format (introduced in 1.2, which patchwork
requires anyway).
This change modifies the default settings.py to use the new format.
Jeremy Kerr [Tue, 29 Mar 2011 14:18:54 +0000 (22:18 +0800)]
notifications: Add code to send notifications
Add a function (patchwork.utils.send_notifications) to process the
PatchChangeNotification queue. We try to group mail to the same sender,
by waiting settings.NOTIFICATION_DELAY_MINUTES to allow other
notifications to arrive.
Jeremy Kerr [Wed, 11 Aug 2010 06:16:28 +0000 (14:16 +0800)]
Add email opt-out system
We're going to start generating emails on patchwork updates, so firstly
allow people to opt-out of all patchwork communications.
We do this with a 'mail settings' interface, allowing non-registered
users to set preferences on their email address. Logged-in users can do
this through the user profile view.
Jeremy Kerr [Thu, 12 Aug 2010 04:15:48 +0000 (12:15 +0800)]
Use generic email confirmation object
Rather than having a UserPerson-specific confirmation, add an
EmailConfirmation object to allow multiple types of confirmations (eg,
opt-out requests in future).
To do this, we use a view (patchwork.views.confirm) that will call the
type-specific view with the confirmation object.
Also, add tests to check that the User/Person linkage system works.
forms: Fix MultipleBooleanField.to_python when the field value is missing
If you write a test for, say, the bundle form of a patch list, you'd
still have to specify the 'no change' value to other form (e.g. the
multiple update one) fields using MultipleBooleanField or else it'd
raise a ValueError when field.clean() is called as part of
form._get_errors().
Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
views: Refactor generic_list() to make it less complicated
When a form is submitted it now delegates to separate processing
functions according to the action. Apart from being more readable it's
now a lot easier to add extra forms for processing lists of patches.
Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Use autodiscover and the new way to hook AdminSite into the URLconf.
AdminSite.root() will be removed in Django-1.3 as noted here:
http://docs.djangoproject.com/en/dev/internals/deprecation/
Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
parser: Get rid of some code duplication in parsemail-batch.sh
Change parsemail-bash.sh to uses parsemail.sh (instead of parsemail.py),
as the former sets the required environment variables that were being
set in parsemail-batch.sh.
Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
This is so that we can use static analysis tools like pyflakes to find
undefined names (and other common mistakes we often make) without being
swamped with unused imports warnings.
Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Wed, 9 Mar 2011 05:20:10 +0000 (13:20 +0800)]
views: use id__in = get_patch_ids() to get the modified patch set
Currently, we generic_list processes patches in order of the patch_id:X
parameter, which is arbitrarily decided by the browser.
By using id__in, we get patches sorted by the default Patch model
ordering. This means that the (arbitrary) order of get_patch_ids()
doesn't affect the ordering of patches that we process, and bundles
are created with a reasonable default patch order.
Dirk Wallenstein [Wed, 16 Feb 2011 08:41:30 +0000 (08:41 +0000)]
tests: Support execution of single tests
Django does not use suite() when executing single tests. Importing all
tests directly into __init__.py has the same effect as the replaced
version of suite().
Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Dirk Wallenstein [Wed, 26 Jan 2011 05:12:29 +0000 (05:12 +0000)]
parser: Recognize mail headers for delegate and state
Introduce two new Patchwork mail headers that determine the initial
state and delegate of a patch. They take a state name as displayed in
Patchwork and the email address of the wanted delegate. An example:
Dirk Wallenstein [Sat, 15 Jan 2011 01:16:21 +0000 (01:16 +0000)]
models: Implement __unicode__ in models instead of __str__
According to the Django documentation at [1] it is recommended to
implement __unicode__ and not __str__. Django's model base class
provides a __str__ method that will use the __unicode__ method and
convert to utf-8. Also, every text value returned from the DB through
the model is unicode.
It is now possible to edit Patches and Persons that have values with
non-ASCII characters through the admin interface.
pwclient: fix handling of UTF-8 char in submitter name
This patch fixes following bug in 'list':
---8<---
# pwclient list -p uboot -w andreas.devel | grep New
Traceback (most recent call last):
File "/Users/andreas/bin/pwclient", line 463, in <module>
main()
File "/Users/andreas/bin/pwclient", line 411, in main
action_list(rpc, filt, submitter_str, delegate_str)
File "/Users/andreas/bin/pwclient", line 182, in action_list
(person['name'], person['email'])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in
position 32: ordinal not in range(128)
--->8---
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Tue, 10 Aug 2010 04:11:40 +0000 (12:11 +0800)]
views: implement CSRF protection
Since we've got the csrf token present, we may as well check it for
requests.
We're using RequestContext already (via PatchworkRequestContext), so we
just need to switch it on in the settings, and add an exemption on the
xmlrpc interface.
templates: Add CSRF (cross-site request forgery) values to form posts
This is a fairly simple patch, basically it does what the error message
told me to do:
"add In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL."
Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Martin Krafft [Sun, 31 Jan 2010 01:32:45 +0000 (02:32 +0100)]
lib/apache2: Add WSGI Handler
Patchwork/Django can be run directly with WSGI, which is bound to be
faster and less complex than FastCGI. This patch provides the necessary
Apache configuration and the WSGI handler, as well as an update to the
docs.
Since python-flup is deprecated and WSGI supersedes FastCGI, it should
be(come) the preferred method. Hence I documented it first.
For the xmlrpc interface to work with WSGI, the HTTP authorization
information needs to be passed to the WSGI handler. This is done by
setting WSGIPassAuthorization On in the apache2 config file snippet.
Martin Krafft [Sun, 31 Jan 2010 02:03:10 +0000 (03:03 +0100)]
docs: Document password-based pgsql login
As an alternative to ident-based authentication for PostgreSQL, one can
use password-based authentication. This patch adds the alternative to
the docs.
Signed-off-by: martin f. krafft <madduck@madduck.net> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Jeremy Kerr [Mon, 19 Jul 2010 06:17:35 +0000 (08:17 +0200)]
views/bundle/public: Lookup on user
Currently, the public bundle view is only looking up bundles by their
name. This may return multiple bundles if two users have bundles with
the same name.
This change adds the user to the bundle lookup.
Reported-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>