diff --git a/src/calibre/db/tables.py b/src/calibre/db/tables.py index c5d7ee216c..58768c9ff5 100644 --- a/src/calibre/db/tables.py +++ b/src/calibre/db/tables.py @@ -151,7 +151,7 @@ class ManyToManyTable(ManyToOneTable): def read_maps(self, db): for row in db.conn.execute( - 'SELECT book, {0} FROM {1}'.format( + 'SELECT book, {0} FROM {1} ORDER BY id'.format( self.metadata['link_column'], self.link_table)): if row[1] not in self.col_book_map: self.col_book_map[row[1]] = [] diff --git a/src/calibre/db/tests/reading.py b/src/calibre/db/tests/reading.py index d1ff81440c..b722d30793 100644 --- a/src/calibre/db/tests/reading.py +++ b/src/calibre/db/tests/reading.py @@ -10,7 +10,7 @@ __docformat__ = 'restructuredtext en' import shutil, unittest, tempfile, datetime from cStringIO import StringIO -from calibre.utils.date import local_tz +from calibre.utils.date import utc_tz from calibre.db.tests.base import BaseTest class ReadingTest(BaseTest): @@ -37,12 +37,12 @@ class ReadingTest(BaseTest): 'tags': (), 'formats':(), 'identifiers': {}, - 'timestamp': datetime.datetime(2011, 9, 7, 13, 54, 41, - tzinfo=local_tz), - 'pubdate': datetime.datetime(2011, 9, 7, 13, 54, 41, - tzinfo=local_tz), - 'last_modified': datetime.datetime(2011, 9, 7, 13, 54, 41, - tzinfo=local_tz), + 'timestamp': datetime.datetime(2011, 9, 7, 19, 54, 41, + tzinfo=utc_tz), + 'pubdate': datetime.datetime(2011, 9, 7, 19, 54, 41, + tzinfo=utc_tz), + 'last_modified': datetime.datetime(2011, 9, 7, 19, 54, 41, + tzinfo=utc_tz), 'publisher': None, 'languages': (), 'comments': None, @@ -69,17 +69,17 @@ class ReadingTest(BaseTest): 'formats': (), 'rating': 4.0, 'identifiers': {'test':'one'}, - 'timestamp': datetime.datetime(2011, 9, 5, 15, 6, - tzinfo=local_tz), - 'pubdate': datetime.datetime(2011, 9, 5, 15, 6, - tzinfo=local_tz), + 'timestamp': datetime.datetime(2011, 9, 5, 21, 6, + tzinfo=utc_tz), + 'pubdate': datetime.datetime(2011, 9, 5, 21, 6, + tzinfo=utc_tz), 'publisher': 'Publisher One', 'languages': ('eng',), 'comments': '
Comments One
', '#enum':'One', '#authors':('Custom One', 'Custom Two'), - '#date':datetime.datetime(2011, 9, 5, 0, 0, - tzinfo=local_tz), + '#date':datetime.datetime(2011, 9, 5, 6, 0, + tzinfo=utc_tz), '#rating':2.0, '#series':'My Series One', '#series_index': 1.0, @@ -98,17 +98,17 @@ class ReadingTest(BaseTest): 'tags': ('Tag One',), 'formats':(), 'identifiers': {'test':'two'}, - 'timestamp': datetime.datetime(2011, 9, 6, 0, 0, - tzinfo=local_tz), - 'pubdate': datetime.datetime(2011, 8, 5, 0, 0, - tzinfo=local_tz), + 'timestamp': datetime.datetime(2011, 9, 6, 6, 0, + tzinfo=utc_tz), + 'pubdate': datetime.datetime(2011, 8, 5, 6, 0, + tzinfo=utc_tz), 'publisher': 'Publisher Two', 'languages': ('deu',), 'comments': 'Comments Two
', '#enum':'Two', '#authors':('My Author Two',), - '#date':datetime.datetime(2011, 9, 1, 0, 0, - tzinfo=local_tz), + '#date':datetime.datetime(2011, 9, 1, 6, 0, + tzinfo=utc_tz), '#rating':4.0, '#series':'My Series Two', '#series_index': 3.0,