Merge branch 'kovidgoyal/master'

This commit is contained in:
Charles Haley 2013-08-23 15:33:09 +02:00
commit 2015762650
4 changed files with 2948 additions and 11 deletions

2928
src/apsw_shell.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -988,9 +988,10 @@ class DB(object):
uv = int(self.user_version)
if sql is None:
from apsw_shell import Shell
callback(_('Dumping database to SQL') + '...')
buf = StringIO()
shell = apsw.Shell(db=self.conn, stdout=buf)
shell = Shell(db=self.conn, stdout=buf)
shell.process_command('.dump')
sql = buf.getvalue()

View File

@ -581,3 +581,13 @@ class WritingTest(BaseTest):
cache.add_format(1, 'ADD', BytesIO(b'xxxx'))
test_invalidate()
# }}}
def test_dump_and_restore(self): # {{{
' Test roundtripping the db through SQL '
cache = self.init_cache()
all_ids = cache.all_book_ids()
cache.dump_and_restore()
self.assertEqual(cache.set_field('title', {1:'nt'}), set([1]), 'database connection broken')
cache = self.init_cache()
self.assertEqual(cache.all_book_ids(), all_ids, 'dump and restore broke database')
# }}}

View File

@ -88,7 +88,6 @@ class BonJour(SimplePlugin): # {{{
{'path':self.prefix+'/opds'}),
]
def start(self):
zeroconf_ip_address = verify_ipV4_address(self.ip_address)
try:
@ -110,7 +109,6 @@ class BonJour(SimplePlugin): # {{{
cherrypy.log.error('Failed to stop BonJour:')
cherrypy.log.error(traceback.format_exc())
stop.priority = 10
cherrypy.engine.bonjour = BonJour(cherrypy.engine)
@ -161,7 +159,7 @@ class LibraryServer(ContentServer, MobileServer, XMLServer, OPDSServer, Cache,
'request.show_tracebacks': show_tracebacks,
'server.socket_host' : listen_on,
'server.socket_port' : opts.port,
'server.socket_timeout' : opts.timeout, #seconds
'server.socket_timeout' : opts.timeout, # seconds
'server.thread_pool' : opts.thread_pool, # number of threads
'server.shutdown_timeout': st, # minutes
})
@ -173,7 +171,7 @@ class LibraryServer(ContentServer, MobileServer, XMLServer, OPDSServer, Cache,
self.exception = None
auth_controller = None
self.users_dict = {}
#self.config['/'] = {
# self.config['/'] = {
# 'tools.sessions.on' : True,
# 'tools.sessions.timeout': 60, # Session times out after 60 minutes
#}
@ -187,7 +185,7 @@ class LibraryServer(ContentServer, MobileServer, XMLServer, OPDSServer, Cache,
'text/xml', 'text/javascript', 'text/css'],
}
if opts.password:
if opts.username and opts.password:
self.users_dict[opts.username.strip()] = opts.password.strip()
auth_controller = AuthController('Your calibre library',
self.users_dict)