def _modifies_cart(func):
@functools.wraps(func)<EOL>def inner(self, *a, **k):<EOL><INDENT>self._fail_if_cart_is_not_active()<EOL>with transaction.atomic():<EOL><INDENT>with BatchController.batch(self.cart.user):<EOL><INDENT>memoised = self.for_user(self.cart.user)<EOL>memoised._modified_by_batch = True<EOL>return func(self, *a, **k)<EOL><DEDENT><DEDENT><DEDENT>return inner<EOL>
Decorator that makes the wrapped function raise ValidationError
    if we're doing something that could modify the cart.

    It also wraps the execution of this function in a database transaction,
    and marks the boundaries of a cart operations batch.