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)
@ -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)