From 848fe8096dd28fa6cf89661eb904b1f1ae7c5793 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Oct 2010 06:57:16 -0600 Subject: [PATCH 1/3] ... --- src/calibre/library/server/content.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/library/server/content.py b/src/calibre/library/server/content.py index 8c5fef4ee1..d95cd1818c 100644 --- a/src/calibre/library/server/content.py +++ b/src/calibre/library/server/content.py @@ -140,7 +140,7 @@ class ContentServer(object): updated = self.build_time else: with cover as f: - updated = fromtimestamp(os.stat(f.name).st_mtime) + updated = fromtimestamp(os.fstat(f.fileno()).st_mtime) cover = f.read() cherrypy.response.headers['Last-Modified'] = self.last_modified(updated) From e46fed78ccf4d8c714c94317a960afe121d954f0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Oct 2010 07:04:38 -0600 Subject: [PATCH 2/3] Fix regression in formats listing in /browse summaries --- src/calibre/library/server/browse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/library/server/browse.py b/src/calibre/library/server/browse.py index 5e7de43d45..f28762dddf 100644 --- a/src/calibre/library/server/browse.py +++ b/src/calibre/library/server/browse.py @@ -495,7 +495,7 @@ class BrowseServer(object): other_fmts = [x for x in fmts if x.lower() != fmt.lower()] if other_fmts: ofmts = [u'{3}'\ - .format(fmt, fname, id_, fmt.upper()) for fmt in + .format(f, fname, id_, f.upper()) for f in other_fmts] ofmts = ', '.join(ofmts) args['other_formats'] = u'%s: ' % \ From ed3909b1a781d3ee1acfebba41d68c24b88f6edb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Oct 2010 07:29:06 -0600 Subject: [PATCH 3/3] Fix bugs in frwrapper returned by lopen on windows --- src/calibre/startup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calibre/startup.py b/src/calibre/startup.py index 1046cd93b3..b5741c1991 100644 --- a/src/calibre/startup.py +++ b/src/calibre/startup.py @@ -120,7 +120,8 @@ if not _run_once: object.__setattr__(self, 'name', name) def __getattribute__(self, attr): - if attr == 'name': + if attr in ('name', '__enter__', '__str__', '__unicode__', + '__repr__'): return object.__getattribute__(self, attr) fobject = object.__getattribute__(self, 'fobject') return getattr(fobject, attr) @@ -141,6 +142,10 @@ if not _run_once: def __unicode__(self): return repr(self).decode('utf-8') + def __enter__(self): + fobject = object.__getattribute__(self, 'fobject') + fobject.__enter__() + return self m = mode[0] random = len(mode) > 1 and mode[1] == '+'