From 3b06b0d131bb656d5fef51f2e35bc53bdf00d9a3 Mon Sep 17 00:00:00 2001 From: "Esteban J. G. Gabancho" Date: Wed, 28 Jun 2017 15:15:39 +0200 Subject: [PATCH] BibDocFile: fix file ordering * Fixes file ordering in the files tab, instead of using the docid, which changes with every revision, uses the file name to do the sorting. --- modules/bibdocfile/lib/bibdocfile_templates.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/bibdocfile/lib/bibdocfile_templates.py b/modules/bibdocfile/lib/bibdocfile_templates.py index f099f52229..eb1c03a6ed 100644 --- a/modules/bibdocfile/lib/bibdocfile_templates.py +++ b/modules/bibdocfile/lib/bibdocfile_templates.py @@ -1,5 +1,5 @@ # This file is part of Invenio. -# Copyright (C) 2012, 2013, 2014 CERN. +# Copyright (C) 2012, 2013, 2014, 2017 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -79,14 +79,17 @@ def tmpl_display_bibrecdocs(self, bibrecdocs, docname="", version="", doctype=No @return: the formatted representation. @rtype: HTML string """ + def _get_ordered_bibdocs(): + d = bibrecdocs.list_bibdocs_by_names(doctype) + return [d[k] for k in sorted(d)] t = "" if docname: try: bibdocs = [bibrecdocs.get_bibdoc(docname)] except Exception, dummy: - bibdocs = bibrecdocs.list_bibdocs(doctype) + bibdocs = _get_ordered_bibdocs() else: - bibdocs = bibrecdocs.list_bibdocs(doctype) + bibdocs = _get_ordered_bibdocs() if bibdocs: types = list_types_from_array(bibdocs) fulltypes = []