Skip to content

Commit 2d21d28

Browse files
committed
mypy validation fix, handling None condition
1 parent 4ae7fc6 commit 2d21d28

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

client/src/cbltest/api/syncgateway.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -793,11 +793,14 @@ async def upsert_documents(
793793
current_doc = await self.get_document(
794794
db_name, update.id, scope, collection
795795
)
796-
current_body = dict(current_doc.body)
797-
current_body.update(update.to_json())
798-
current_body["_id"] = update.id
799-
if update.rev:
800-
current_body["_rev"] = update.rev
796+
if current_doc is not None:
797+
current_body = dict(current_doc.body)
798+
current_body.update(update.to_json())
799+
current_body["_id"] = update.id
800+
if update.rev:
801+
current_body["_rev"] = update.rev
802+
else:
803+
current_body = update.to_json()
801804
except Exception:
802805
current_body = update.to_json()
803806
merged_updates.append(

0 commit comments

Comments
 (0)