summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/views/__init__.py
Commit message (Collapse)AuthorAgeFilesLines
* views: fix patch_to_mbox() for postscriptAndreas Bießmann2014-07-241-5/+2
| | | | | | | | | Before we changed the comment 'some comment\n---\n some/file | 1 +' to 'some comment\n\n---\nsome/file | 1 +\n'. Now we pass this comment unchanged. Signed-off-by: Andreas Bießmann <andreas@biessmann.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/generic_list: reduce number of queries in list renderingJeremy Kerr2014-05-081-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we do two database queries per patch on a list view; one to retrieve the submitter, and one for the state. This patch adds a .select_related to fetch for the submitter and state, and a .defer() to prevent loading large amounts of text data from the patch content and headers. This gives a significant reduction in the work per request. For a paginated list view (ie 100 patches per page): before after User 1344 ms 228 ms System 170 ms 25 ms Total 1514 ms 253 ms Elapsed 1605 ms 274 ms Context switch (vol) 4206 40 Context switch (invol) 326 75 SQL queries 212 15 Longest query 13 ms 5 ms Total query time 121 ms 20 ms Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views/order: Apply default ordering as secondaryJeremy Kerr2014-04-211-1/+1
| | | | | | | | | | 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>
* 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>
* views/mbox: Use Date: header from original messageJeremy Kerr2013-06-101-2/+4
| | | | | | | | | | | 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-101-0/+82
| | | | | | | | 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>
* 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>
* models: Project.is_editable to check whether a user has edit rightsGuilherme Salgado2011-04-141-2/+1
| | | | | | | This is to replace the couple of places where we duplicate this same check. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* views: Refactor generic_list() to make it less complicatedGuilherme Salgado2011-04-141-17/+56
| | | | | | | | | 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>
* views: use id__in = get_patch_ids() to get the modified patch setJeremy Kerr2011-03-091-7/+1
| | | | | | | | | | | | 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. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [views] Allow Order class to be user-editableJeremy Kerr2009-02-081-3/+5
| | | | | | | This can be enabled with the editable_order parameter to generic_list Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* [views] Fix empty bundle showing entire project's patchesJeremy Kerr2008-09-201-1/+1
| | | | | | | | | | If a bundle is empty, we end up triggering the 'if not patches' check in generic_list(), which repopulates the patch list with the current project's patches. So, check for None instead, and leave the patch list empty. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* In some places tabs are used instead of spaces for indentation,Nate Case2008-08-231-2/+2
| | | | | | | | | | | even when other lines of a method are indented with spaces. This gets rid of all tabs and uses spaces everywhere. [Reworked to apply on newer code by Jeremy] Signed-off-by: Nate Case <ncase@xes-inc.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add project argument to set_patchesJeremy Kerr2008-08-211-2/+2
| | | | | | MultiplePatchForm needs a project, so pass one down. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Inital commitJeremy Kerr2008-08-211-0/+90
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>