The template ordering on a productseries or distroseries +templates page
seemed to be rather arbitrary. In reality, they were ordered by database
ids, which is not very useful if you want to find a specific template on
the page.
This ordering is taken from the POTemplateSubset ordering where the
template are retrieved from the database.
== Proposed fix ==
Add an optional ordering flag to POTemplateSubset to apply an ordering
by names to the query. The view code can then set that flag.
Ordering will be by POTemplate.name for a productseries and by
(SourcePackageName.name, POTemplate.name) for a distroseries.
== Implementation details ==
The flag 'ordered_by_names' defaults to 'False' to retain the old
behaviour on which other code (and tests) might depend.
Note that the latter appears sorted, even without this fix, but that is
not true. Some templates are out of order. They were probably imported
in alphabetical order.
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
= Bug 461756 =
The template ordering on a productseries or distroseries +templates page
seemed to be rather arbitrary. In reality, they were ordered by database
ids, which is not very useful if you want to find a specific template on
the page.
This ordering is taken from the POTemplateSubset ordering where the
template are retrieved from the database.
== Proposed fix ==
Add an optional ordering flag to POTemplateSubset to apply an ordering
by names to the query. The view code can then set that flag.
Ordering will be by POTemplate.name for a productseries and by ame.name, POTemplate.name) for a distroseries.
(SourcePackageN
== Implementation details ==
The flag 'ordered_by_names' defaults to 'False' to retain the old
behaviour on which other code (and tests) might depend.
== Tests ==
bin/test -vvct distroseries- templates -t productseries- templates
== Demo and Q/A ==
(rev 8619 on staging or rev 9804 on edge for bug 461818 to be fixed.)
Go to this url and verify that the templates are listed alphabetically /translations. staging. launchpad. net/ubuntu/ karmic/ +templates
by the names of the source packages and the names of the templates.
https:/
Here is one for a product, should be ordered by the names of the templates: /translations. staging. launchpad. net/ocportal/ 4.2.0/+ templates
https:/
Note that the latter appears sorted, even without this fix, but that is
not true. Some templates are out of order. They were probably imported
in alphabetical order.
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files: translations/ interfaces/ potemplate. py translations/ browser/ distroseries. py translations/ stories/ productseries/ xx-productserie s-templates. txt translations/ browser/ productseries. py translations/ model/potemplat e.py translations/ stories/ distroseries/ xx-distroseries -templates. txt
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
== Pylint notices ==
lib/lp/ translations/ interfaces/ potemplate. py
9: [F0401] Unable to import 'lazr.enum' (No module named enum)