Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vegu committed May 20, 2024
1 parent 2d3e2b8 commit 6dc2bf8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/peeringdb/_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,14 @@ def update_one(self, res, pk: int, depth=0):
)

row = self.fetcher.get(res.tag, pk, depth=0, force_fetch=True)
# create object instance (unsaved)
obj, _ = self.create_obj(row, res)
try:
# attempt update existing instance of object (if exists, will save)
self.copy_object(obj)
except self.backend.object_missing_error(self.backend.get_concrete(res)):
# object does not exist, create object instance and save as
# new object
obj, _ = self.create_obj(row, res)
self.backend.save(obj)

Expand Down

0 comments on commit 6dc2bf8

Please sign in to comment.