[pybliographer] Let's save bibtex entries sorted



commit 9ae427baa10b0e448e57ffcf34c5b34b6cea6fa5
Author: Zoltan Kota <zoltank gmail com>
Date:   Thu Mar 6 14:10:55 2014 +0100

    Let's save bibtex entries sorted
    
    Now we save bibtex entries sorted by the entry key. It helps to
    keep the database file 'ordered'. It may be useful if somebody
    wants to track the file in version control...
    Fixes SF bug #92.

 Pyblio/GnomeUI/Document.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/Pyblio/GnomeUI/Document.py b/Pyblio/GnomeUI/Document.py
index 2f6af90..be8b3ff 100644
--- a/Pyblio/GnomeUI/Document.py
+++ b/Pyblio/GnomeUI/Document.py
@@ -710,7 +710,7 @@ class Document (Connector.Publisher):
                 self.w.error (_("Error during autosaving:\n%s") % error [1])
                 return False
 
-            iterator = Selection.Selection (sort = self.selection.sort)
+            iterator = Selection.Selection (sort = Sort.Sort([Sort.KeySort()]))
             Open.bibwrite (iterator.iterator (self.data.iterator ()),
                            out = savefile, how = how, database=self.data)
 
@@ -732,7 +732,7 @@ class Document (Connector.Publisher):
         Utils.set_cursor (self.w, 'clock')
         try:
             try:
-                self.data.update (self.selection.sort)
+                self.data.update (Sort.Sort([Sort.KeySort()]))
             except (OSError, IOError), error:
                 Utils.set_cursor (self.w, 'normal')
                 self.w.error (_("Unable to save `%s':\n%s") % (str (self.data.key),
@@ -776,7 +776,7 @@ class Document (Connector.Publisher):
 
         Utils.set_cursor (self.w, 'clock')
 
-        iterator = Selection.Selection (sort = self.selection.sort)
+        iterator = Selection.Selection (sort = Sort.Sort([Sort.KeySort()]))
         Open.bibwrite (iterator.iterator (self.data.iterator ()),
                        out = file, how = how, database=self.data)
         file.close ()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]