Open jesteria opened 10 years ago
The item manager should provide a method encapsulating the non-trivial logic of get-or-create, a la:
try: return get(…) except DoesNotExist: item = Item(…) try: item.save() except ConditionalCheckFailedException: exc_info = sys.exc_info() try: return get() except DoesNotExist: six.reraise(*exc_info) else: return item
The item manager should provide a method encapsulating the non-trivial logic of get-or-create, a la: