summaryrefslogtreecommitdiffstats
path: root/apps
Commit message (Collapse)AuthorAgeFilesLines
...
* tests: Make tests compatible with django 1.6Jeremy Kerr2014-04-2315-14/+14
| | | | | | | The default test runner in django 1.6 relies on tests being named test*.py, rather that an explicit <appname>.test module. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Fix django-1.6 incompatibilitiesJeremy Kerr2014-04-232-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're seeing a couple of final quirks running the testsuite on django 1.6: Traceback (most recent call last): File "patchwork/apps/patchwork/tests/notifications.py", line 182, in testNotificationEscaping errors = send_notifications() File "patchwork/apps/patchwork/utils.py", line 227, in send_notifications delete_notifications() File "patchwork/apps/patchwork/utils.py", line 197, in delete_notifications pk__in = notifications).delete() File "/usr/lib/python2.7/dist-packages/django/db/models/manager.py", line 163, in filter return self.get_queryset().filter(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 590, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 608, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/usr/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1198, in add_q clause = self._add_q(where_part, used_aliases) File "/usr/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1232, in _add_q current_negated=current_negated) File "/usr/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1122, in build_filter lookup_type, value) File "/usr/lib/python2.7/dist-packages/django/db/models/fields/related.py", line 1107, in get_lookup_constraint values = [get_normalized_value(value) for value in raw_value] File "/usr/lib/python2.7/dist-packages/django/db/models/fields/related.py", line 1084, in get_normalized_value value_list.append(getattr(value, source.attname)) AttributeError: 'PatchChangeNotification' object has no attribute 'id' - we're specifying our own pk here, so the PatchChangeNotification has no id attribute; it looks like the pk__in syntax is expecting IDs. We also need a default value for BooleanField, as we're getting integrity errors when creating rows with no explicit send_notifications set. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/utils: Don't rely on field error message APIJeremy Kerr2014-04-221-1/+1
| | | | | | | The location of EmailField's message changed in 1.6, just use a fixed string instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/patchparser: Inherit from djagno.test.TestCaseJeremy Kerr2014-04-221-8/+8
| | | | | | | Since these tests may touch the database, we need the transaction handling that django.test.TestCase provides. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Defer Person creation/linkage until registration is confirmedJeremy Kerr2014-04-225-14/+33
| | | | | | | | We currently create Person objects when a registration is submitted, not when it is confirmed. This can lead to stale Person objects for unconfirmed registrations. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add unconfirmed registration expiryJeremy Kerr2014-04-225-4/+151
| | | | | | | | | | | | Currently, unconfirmed registrations remain in the database. Although we have an expiry for the registrations, we don't actually remove rows from the database. This can clog the admin interface up with unnecessary registration spam. We currently have a patchwork cron script to send notifications on patch changes, so hook this into a new do_expiry function. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Update manage.py to post a post-1.4 version.Jeremy Kerr2014-04-222-12/+8
| | | | | | | | | | Django version 1.6 deprecates some of the django.core.management API, so we need a post-1.4 version. The semantics with app include paths have changed with this version, so update the urlconf to use the same path as manage.py. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Remove references to django.conf.urls.defaultsJeremy Kerr2014-04-212-2/+2
| | | | | | | django.conf.urls.defaults has been deprecated, replace with django.conf.urls, and remove the 'import *' syntax. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/order: Apply default ordering as secondaryJeremy Kerr2014-04-212-3/+15
| | | | | | | | | | If we're ordering by a certain non-default field, then the ordering of patches with that same field will be arbitrary. This change applies the default as a secondary ordering, so we're not left with an arbitrary sub-order. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: fix handling UTF-8 in patch infoAndreas Bießmann2014-01-281-1/+1
| | | | | | | | | | | | | | | | | | | This patch fixes following error when redirecting 'pwclient info' output: ---8<--- andreas@dockstar % pwclient info 295268 > /tmp/test.out Traceback (most recent call last): File "/home/andreas/bin/pwclient", line 508, in <module> main() File "/home/andreas/bin/pwclient", line 471, in main action_info(rpc, patch_id) File "/home/andreas/bin/pwclient", line 242, in action_info print("- %- 14s: %s" % (key, value)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in position 29: ordinal not in range(128) --->8--- Signed-off-by: Andreas Bießmann <andreas@biessmann.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add a config option to FORCE_HTTPS_LINKSKonstantin Ryabitsev2013-10-132-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | In situations where SSL is terminated at the load-balancer, we cannot rely on guessing the scheme based on whether patchwork itself was accessed via http or https, since the last-leg is always going to be done over http. Unfortunately, wrongly using http:// URLs results in unusable .pwclientrc files, since xmlrpc does not handle http->https redirects and instead displays a traceback. This change introduces a FORCE_HTTPS_LINKS option, which forces pwclientrc links to always return "https" regardless of how the project itself is accessed. It appears that the http/https check is currently only used for generating pwclientrc -- a lot of other places seem to hardcode "http://" and rely on the server to transparently upgrade the connection. This is not a secure approach (it allows for MITM and SSL-Strip attacks) and therefore all places currently hardcoding http://{{site.domain}} and similar should be switched to using the "sheme" variable, the same as done for generating pwclientrc files. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: Use strings from fields module for error testsJeremy Kerr2013-10-133-9/+11
| | | | | | | Rather than hard-coding expected error messages, grab the values from the fields module, and expose through the test utils. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser: Add support for rename-only patchesJeremy Kerr2013-10-134-0/+98
| | | | | | | | | | | | | Yann E. MORIN reported a problem where patchwork drops patches with only renames: http://lists.busybox.net/pipermail/buildroot/2013-October/079999.html This change fixes the issue by adding a new state for patch 'meta' headers: header test which is not parsed as a hunk, but has the same behaviour as a hunk in that it will cause the patchbuf to be populated. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/base: Implement limit for submitter autocompletionJeremy Kerr2013-10-132-5/+27
| | | | | | | Add a limit parameter to the completion view, and pass a limit of 20 results in the javascript. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/base: Include email addresses in submitter autocomplete searchJeremy Kerr2013-10-133-1/+50
| | | | | | | | Currently, we only search names, which is a problem for Person objects with only an email address set. This change includes the email addresses in the search. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* notifications: add project name to patch update notificationWolfram Sang2013-06-161-0/+3
| | | | | | | | | | Based on a feature request & patch from Wolfram Sang <wsa@the-dreams.de>. Notifications may span multiple projects, so include a summary in the subject line, and detail in the header. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Don't use total_seconds for python < 2.7Konstantin Ryabitsev2013-06-161-2/+2
| | | | | | | | | | The total_seconds function was added to datetime in python-2.7. For compatibility with previous versions of python, use its suggested equivalent (except drop microseconds, since we don't care about them in this context). Signed-off-by: Konstantin Ryabitsev <mricon@kernel.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/mboxviews: Add test for header-supplied datesJeremy Kerr2013-06-101-0/+15
| | | | | | | Check that a Date: header in the original message is equivalent to the header generated in the mbox output. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/mbox: Use Date: header from original messageJeremy Kerr2013-06-102-2/+12
| | | | | | | | | | | Since we use UTC for internal date storage, we lose the timestamp info from the original patch submissions. This means that the mbox views (which are typically passed through to SCM commit logs) lose the timezone information. This change uses the Date header from the original message, if possible. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views: Move mbox handling from models to viewsJeremy Kerr2013-06-105-88/+92
| | | | | | | | Mbox generation is related to views, not the models themselves. This change creates a patch_to_mbox function in the views/ directory, which the actual view handlers use instead of Patch.mbox(). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* models: Fix invalid dates in patch mboxJeremy Kerr2013-06-102-2/+28
| | | | | | | | | | | | | Currently, the Date header in mbox views is incorrect; datetime.datetime.utctimetuple assumes that the date is in the local timezone, but we keep all dates as UTC. This change replaces utctimetuple with a manual calculation of the seconds-since-epoch timestamp, which email.utils.formatdate requires. We add a testcase for this too. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* models: fix From header in mbox viewAndreas Bießmann2013-05-141-1/+5
| | | | | | | | | | | | The From header in mbox view was corrupt for patch submitters with non-ASCII characters in their names. RFC 2822 requires to retain the mail as ASCII in braces '<' and '>' while the name should be coded. Before we coded the whole string which led to some MUA misinterpret the From header (while git could manage it). Fix this by coding just the name and let the email untouched. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/mboxviews: add test for correct From headerAndreas Bießmann2013-05-141-0/+25
| | | | | | | | Currently we produce corrupted 'From' header in mbox output when senders name contains non ASCII characters. Provide a test to show this issue. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* bundles: Don't display 'Change order' button on public bundle viewJeremy Kerr2013-04-212-1/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* bundles: Don't allow slashes in bundle namesJeremy Kerr2013-04-202-1/+7
| | | | | | | | Because bundle names are used in URLs, we don't want slashes in them. Include a SQL migration script. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* bundles: Remove separate public bundle viewsJeremy Kerr2013-04-206-74/+197
| | | | | | | | | | | | Having two views for bundles (public and non-public) can cause confusion when bundle owners want to share a URL; it's not obvious that the private URL isn't shareable. This change removes the private URLs, and puts all bundles under the /bundle/<username>/<bundlename>/ URL space. For non-public bundles, this will just 404 for non-owners. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* forms: Only pass post data to multiplepatchform if that was what was submittedJeremy Kerr2012-12-301-1/+8
| | | | | | | | | | | | | When updating bundles, we get a spurious error message in the MultiplePatchForm; it's performing validation on the blank form data. This change only passes the post data to the MuliplePatchForm if we detect (through data['form']) that it was the MultiplePatchForm that was submitted. This fixes the current testsuite failure. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/bundle: Check for form errors during bundle updatesJeremy Kerr2012-12-301-0/+23
| | | | | | | | | | Add a check for patchform errors during bundle update operations, both when logged in as a maintainer and a regular user. This exposes a problem with the maintainer patchform: we see an unexpected form error with the state input. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/bundle: Add bundle update tests, fix missing action behaviourJeremy Kerr2012-12-302-0/+55
| | | | | | | Add a couple of tests for the bundle update views. This exposes a problem with no action is specified, so fix this too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/bundle: Add tests for public bundle viewsJeremy Kerr2012-12-301-0/+27
| | | | | | | Ensure that public bundles are accessible, and that private ones are not. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/bundle: Allow downloading public bundle as mboxSimo Sorce2012-12-302-5/+15
| | | | | | | | | | | Downloading single patches anonymously is allowed, we may as well allow downloading public bundles as mboxes. This patch also changes the file name to be bundle-<id>-<name>.mbox so that the file name is unique even if bundle names are reused. Signed-off-by: Simo Sorce <idra@samba.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: Add a little more space in 'pwclient list'Doug Anderson2012-12-301-3/+3
| | | | | | | | New patch IDs are now 7 digits long on patchwork.kernel.org. Give a little more space. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* xmlrpc: Avoid trying to marshall None for people with no nameDoug Anderson2012-12-301-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a person sent patches with no real name, they may have None for their name. In this case just use their email address as their name. The previous pwclient error that would show up looks like: $ pwclient list -w anonymous@example.com Traceback (most recent call last): File ".../pwclient", line 631, in <module> main() File ".../pwclient", line 570, in main action_list(rpc, filt, submitter_str, delegate_str, series_str) File ".../pwclient", line 316, in action_list ids = person_ids_by_name(rpc, submitter_str) File ".../pwclient", line 241, in person_ids_by_name people = rpc.person_list(name, 0) File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__ return self.__send(self.__name, args) File "/usr/lib/python2.7/xmlrpclib.py", line 1578, in __request verbose=self.__verbose File "/usr/lib/python2.7/xmlrpclib.py", line 1264, in request return self.single_request(host, handler, request_body, verbose) File "/usr/lib/python2.7/xmlrpclib.py", line 1297, in single_request return self.parse_response(response) File "/usr/lib/python2.7/xmlrpclib.py", line 1473, in parse_response return u.close() File "/usr/lib/python2.7/xmlrpclib.py", line 793, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <Fault 1: "<type 'exceptions.TypeError'>:cannot marshal None unless allow_none is enabled"> Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: Add command for printing patch infoDoug Anderson2012-12-301-2/+14
| | | | | | | | This command prints raw information that patchwork has about a patch. This can be useful for debugging problems with patchwork. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add URL and SCM data to projectsSimo Sorce2012-11-151-0/+3
| | | | | | | | | | | | | | | This allows us to display friendly links to the project website, web SCM UI and SCM URL. For example for the patchwork project these could be set to: web_url: http://jk.ozlabs.org/projects/patchwork/ scm_url: git://ozlabs.org/home/jk/git/patchwork webscm_url: http://git.ozlabs.org/?p=patchwork;a=tree Requires a DB schema upgrade Signed-off-by: Simo Sorce <idra@samba.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: lookup patch_id given Message-IdBen Myers2012-11-051-2/+9
| | | | | | | | Add a pwclient search option '-m' to look up a patch id given a Message-id. This is useful for automation and mailer hooks. Signed-off-by: Ben Myers <bpm@sgi.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* bundles: Add check for duplicate bundlesJeremy Kerr2012-10-222-0/+36
| | | | | | ... rather than failing with an IntegrityError. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* requestcontext: Initialise 'messages' context varJeremy Kerr2012-10-081-1/+4
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* settings: Use new class for auth context processorJeremy Kerr2012-10-081-1/+1
| | | | | | Since django 1.2 auth module is in contrib, not core. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* settings: Use class-based template loading APIJeremy Kerr2012-10-081-2/+2
| | | | | | | The TEMPLATE_LOADERS setting changed in django-1.2. Template loaders are now based on calsses rather than callables. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* settings: Add message middlewareJeremy Kerr2012-09-061-0/+1
| | | | | | This seems to be required for admin updates. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pwclient: Pass input to git-am as a UTF-8 stringJeremy Kerr2012-09-041-1/+1
| | | | | | .. to prevent ascii codec exceptions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* templates: Don't rely on bool(Page)Jeremy Kerr2012-06-173-1/+40
| | | | | | | | | The behaviour of bool(Page) changed in django 1.4 - it no longer evaluates to False when page has no objects. When checking for an empty patch list, use page.paginator.count. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* models: Add connection parameter for HashField.db_type.Jeremy Kerr2012-05-041-1/+1
| | | | | | This is required by django-1.4. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: Find test data relative to file locationDirk Wallenstein2012-05-041-2/+2
| | | | | | | Make test execution independent of the current directory. Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/notifications: Add test for escaped patch namesJeremy Kerr2012-05-011-0/+14
| | | | | | .. to test for the fix introduced in 18986b7e. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: Check the right optin emailDirk Wallenstein2012-05-011-1/+1
| | | | | Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/patchparser: abstract delegate and state testingJeremy Kerr2012-04-301-21/+17
| | | | | | No need to repeat the same query logic. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/patchparser: don't assume PK valuesJeremy Kerr2012-04-301-14/+21
| | | | | | | PK values may not start at 1 for each test, so remove filters that assume this. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests: Add tests for explicit delegate and state requestsDirk Wallenstein2012-04-301-2/+106
| | | | | Signed-off-by: Dirk Wallenstein <halsmit@t-online.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>