def mutating(func):
 @functools.wraps(func)
 def wrapped(self, req, *args, **kwargs):
  if req.context.read_only:
   msg = _('Read-only access')
   LOG.debug(msg)
   raise exc.HTTPForbidden(msg, request=req, content_type='text/plain')
  return func(self, req, *args, **kwargs)
 return wrapped

def mutating ( func ) : @ functools . wraps ( func ) def wrapped ( self , req , * args , ** kwargs ) : if req . context . read_only : msg = _ ( 'Read-only access' ) LOG . debug ( msg ) raise exc . HTTPForbidden ( msg , request = req , content_type = 'text/plain' ) return func ( self , req , * args , ** kwargs ) return wrapped
decorator to enforce read-only logic .