fix_repeat_is_list
This commit is contained in:
parent
388ca82466
commit
6a71fc3ca5
@ -23,7 +23,7 @@ class FullSyncManager:
|
||||
"Integrity check failed for uploaded collection database file."
|
||||
)
|
||||
|
||||
def upload(self, col: Collection, data: bytes, session) -> str:
|
||||
def upload(self, col: Collection, data: bytes, session) :
|
||||
"""
|
||||
Uploads a sqlite database from the client to the sync server.
|
||||
|
||||
|
||||
@ -151,7 +151,7 @@ select id from notes where mid = ?) limit 1"""
|
||||
self.col.db.scalar("select count() from graves"),
|
||||
len(self.col.models.all()),
|
||||
len(self.col.decks.all()),
|
||||
len(self.col.decks.allConf()),
|
||||
len(self.col.decks.all_config()),
|
||||
]
|
||||
|
||||
def usnLim(self):
|
||||
|
||||
@ -141,13 +141,15 @@ class SyncCollectionHandler(Syncer):
|
||||
|
||||
def sanityCheck2(self, client):
|
||||
server = self.sanityCheck()
|
||||
status="ok"
|
||||
if client != server:
|
||||
logger.info(
|
||||
f"sanity check failed with server: {server} client: {client}"
|
||||
)
|
||||
status='bad'
|
||||
|
||||
return dict(status, c=client, s=server)
|
||||
|
||||
return dict(status="bad", c=client, s=server)
|
||||
return dict(status="ok")
|
||||
|
||||
def finish(self):
|
||||
return super().finish(anki.utils.intTime(1000))
|
||||
@ -418,13 +420,12 @@ class Requests(object):
|
||||
if input is None:
|
||||
return
|
||||
if env.get('HTTP_TRANSFER_ENCODING','0') == 'chunked':
|
||||
bd=b''
|
||||
size = int(input.readline(),16)
|
||||
while size > 0:
|
||||
bd += (input.read(size+2)).strip()
|
||||
body += (input.read(size+2)).strip()
|
||||
size = int(input.readline(),16)
|
||||
repeat=re.findall(b'^(.*?)Content-Disposition: form-data; name="data"',bd,re.MULTILINE)
|
||||
items=re.split(repeat,bd)
|
||||
repeat=re.findall(b'^(.*?)Content-Disposition: form-data; name="data"',body,re.MULTILINE)[0]
|
||||
items=re.split(repeat,body)
|
||||
# del first ,last item
|
||||
items.pop()
|
||||
items.pop(0)
|
||||
@ -655,6 +656,8 @@ class SyncApp:
|
||||
elif url == 'upload':
|
||||
thread = session.get_thread()
|
||||
result = thread.execute(self.operation_upload, [data['data'], session])
|
||||
print('#### from call')
|
||||
print(result)
|
||||
resp=Response(json.dumps(result))
|
||||
return resp(env,start_resp)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user