Hello Kovid,
The new contentserver (calibre 0.7.26) is broken with non-US (e.g. German) databases and localisation.
Output of the webpage e.g. when clicking on
http://127.0.0.1:8080/browse/category/newest
Code:
500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.
Traceback (most recent call last):
File "/usr/local/lib/calibre/cherrypy/_cprequest.py", line 606, in respond
cherrypy.response.body = self.handler()
File "/usr/local/lib/calibre/cherrypy/_cpdispatch.py", line 25, in __call__
return self.callable(*self.args, **self.kwargs)
File "/usr/local/lib/calibre/calibre/library/server/utils.py", line 49, in do
ans = func(*args, **kwargs)
File "/usr/local/lib/calibre/calibre/library/server/browse.py", line 174, in do
ans = func(self, *args, **kwargs)
File "/usr/local/lib/calibre/calibre/library/server/browse.py", line 545, in browse_matches
return self.browse_template(sort, category=False).format(
File "/usr/local/lib/calibre/calibre/library/server/browse.py", line 257, in browse_template
ans = ans.replace('{library_name}', xml(os.path.basename(lp)))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3526: ordinal not in range(128)
The following little patch fixes these encoding issues for me:
Code:
--- src/calibre/library/server/browse.py 2010-10-30 20:53:58.000000000 +0200
+++ src/calibre/library/server/browse.patched.py 2010-10-31 13:53:54.627473906 +0100
@@ -252,8 +252,6 @@
lp = self.db.library_path
if isbytestring(lp):
lp = force_unicode(lp, filesystem_encoding)
- if isinstance(ans, unicode):
- ans = ans.encode('utf-8')
ans = ans.replace('{library_name}', xml(os.path.basename(lp)))
ans = ans.replace('{library_path}', xml(lp, True))
ans = ans.replace('{initial_search}', initial_search)
Please apply, if appropriate.
Thanks for the great program,
Felix