def create_revision(manage_manually=False, using=None):
 def decorator(func):
  @wraps(func)
  def do_revision_view(request, *args, **kwargs):
   if _request_creates_revision(request):
    try:
     with create_revision_base(manage_manually=manage_manually, using=None):
      response = func(request, *args, **kwargs)
      if (response.status_code >= 400):
       raise _RollBackRevisionView(response)
      _set_user_from_request(request)
      return response
    except _RollBackRevisionView as ex:
     return ex.response
   return func(request, *args, **kwargs)
  return do_revision_view
 return decorator

def create_revision ( manage_manually = False , using = None ) : def decorator ( func ) : @ wraps ( func ) def do_revision_view ( request , * args , ** kwargs ) : if _request_creates_revision ( request ) : try : with create_revision_base ( manage_manually = manage_manually , using = None ) : response = func ( request , * args , ** kwargs ) if ( response . status_code >= 400 ) : raise _RollBackRevisionView ( response ) _set_user_from_request ( request ) return response except _RollBackRevisionView as ex : return ex . response return func ( request , * args , ** kwargs ) return do_revision_view return decorator
view decorator that wraps the request in a revision .