Make potential future instances of #8 easier to debug

With hostNum prepended to the address, the client won't even be
able to connect and will return an error message with the invalid
address.

Example:
    requests.exceptions.InvalidSchema: No connection adapters were found for '6http://localhost:27701/sync/meta'
This commit is contained in:
flan 2018-12-24 16:36:09 +01:00
parent 61b4582364
commit 537c4daa94
2 changed files with 2 additions and 2 deletions

View File

@ -61,7 +61,7 @@ create a file named `__init__.py` containing the code below and put it in
import anki.sync, anki.hooks, aqt import anki.sync, anki.hooks, aqt
addr = "http://127.0.0.1:27701/" # put your server address here addr = "http://127.0.0.1:27701/" # put your server address here
anki.sync.SYNC_BASE = addr + "%s" anki.sync.SYNC_BASE = "%s" + addr
def resetHostNum(): def resetHostNum():
aqt.mw.pm.profile['hostNum'] = None aqt.mw.pm.profile['hostNum'] = None
anki.hooks.addHook("profileLoaded", resetHostNum) anki.hooks.addHook("profileLoaded", resetHostNum)

View File

@ -56,7 +56,7 @@ def updateui(self, state):
def setserver(): def setserver():
aqt.mw.pm.profile['hostNum'] = None aqt.mw.pm.profile['hostNum'] = None
anki.sync.SYNC_BASE = config['addr'] + "%s" anki.sync.SYNC_BASE = "%s" + config['addr']
addHook("profileLoaded", setserver) addHook("profileLoaded", setserver)
aqt.preferences.Preferences.__init__ = wrap(aqt.preferences.Preferences.__init__, addui, "after") aqt.preferences.Preferences.__init__ = wrap(aqt.preferences.Preferences.__init__, addui, "after")