mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Merge branch 'kovidgoyal/master'
This commit is contained in:
commit
2015762650
2928
src/apsw_shell.py
Normal file
2928
src/apsw_shell.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -988,9 +988,10 @@ class DB(object):
|
|||||||
uv = int(self.user_version)
|
uv = int(self.user_version)
|
||||||
|
|
||||||
if sql is None:
|
if sql is None:
|
||||||
|
from apsw_shell import Shell
|
||||||
callback(_('Dumping database to SQL') + '...')
|
callback(_('Dumping database to SQL') + '...')
|
||||||
buf = StringIO()
|
buf = StringIO()
|
||||||
shell = apsw.Shell(db=self.conn, stdout=buf)
|
shell = Shell(db=self.conn, stdout=buf)
|
||||||
shell.process_command('.dump')
|
shell.process_command('.dump')
|
||||||
sql = buf.getvalue()
|
sql = buf.getvalue()
|
||||||
|
|
||||||
|
@ -581,3 +581,13 @@ class WritingTest(BaseTest):
|
|||||||
cache.add_format(1, 'ADD', BytesIO(b'xxxx'))
|
cache.add_format(1, 'ADD', BytesIO(b'xxxx'))
|
||||||
test_invalidate()
|
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')
|
||||||
|
# }}}
|
||||||
|
@ -88,7 +88,6 @@ class BonJour(SimplePlugin): # {{{
|
|||||||
{'path':self.prefix+'/opds'}),
|
{'path':self.prefix+'/opds'}),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
zeroconf_ip_address = verify_ipV4_address(self.ip_address)
|
zeroconf_ip_address = verify_ipV4_address(self.ip_address)
|
||||||
try:
|
try:
|
||||||
@ -110,7 +109,6 @@ class BonJour(SimplePlugin): # {{{
|
|||||||
cherrypy.log.error('Failed to stop BonJour:')
|
cherrypy.log.error('Failed to stop BonJour:')
|
||||||
cherrypy.log.error(traceback.format_exc())
|
cherrypy.log.error(traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
stop.priority = 10
|
stop.priority = 10
|
||||||
|
|
||||||
cherrypy.engine.bonjour = BonJour(cherrypy.engine)
|
cherrypy.engine.bonjour = BonJour(cherrypy.engine)
|
||||||
@ -161,7 +159,7 @@ class LibraryServer(ContentServer, MobileServer, XMLServer, OPDSServer, Cache,
|
|||||||
'request.show_tracebacks': show_tracebacks,
|
'request.show_tracebacks': show_tracebacks,
|
||||||
'server.socket_host' : listen_on,
|
'server.socket_host' : listen_on,
|
||||||
'server.socket_port' : opts.port,
|
'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.thread_pool' : opts.thread_pool, # number of threads
|
||||||
'server.shutdown_timeout': st, # minutes
|
'server.shutdown_timeout': st, # minutes
|
||||||
})
|
})
|
||||||
@ -173,7 +171,7 @@ class LibraryServer(ContentServer, MobileServer, XMLServer, OPDSServer, Cache,
|
|||||||
self.exception = None
|
self.exception = None
|
||||||
auth_controller = None
|
auth_controller = None
|
||||||
self.users_dict = {}
|
self.users_dict = {}
|
||||||
#self.config['/'] = {
|
# self.config['/'] = {
|
||||||
# 'tools.sessions.on' : True,
|
# 'tools.sessions.on' : True,
|
||||||
# 'tools.sessions.timeout': 60, # Session times out after 60 minutes
|
# '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'],
|
'text/xml', 'text/javascript', 'text/css'],
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.password:
|
if opts.username and opts.password:
|
||||||
self.users_dict[opts.username.strip()] = opts.password.strip()
|
self.users_dict[opts.username.strip()] = opts.password.strip()
|
||||||
auth_controller = AuthController('Your calibre library',
|
auth_controller = AuthController('Your calibre library',
|
||||||
self.users_dict)
|
self.users_dict)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user