def owner_required(f=None, require_owner=True):
 def decorator(func):
  @functools.wraps(func)
  def wrapper(request, username, slug, *args, **kw):
   collection = get_collection(request, username, slug)
   if acl.check_collection_ownership(request, collection, require_owner=require_owner):
    return func(request, collection, username, slug, *args, **kw)
   else:
    raise PermissionDenied
  return wrapper
 return (decorator(f) if f else decorator)

def owner_required ( f = None , require_owner = True ) : def decorator ( func ) : @ functools . wraps ( func ) def wrapper ( request , username , slug , * args , ** kw ) : collection = get_collection ( request , username , slug ) if acl . check_collection_ownership ( request , collection , require_owner = require_owner ) : return func ( request , collection , username , slug , * args , ** kw ) else : raise PermissionDenied return wrapper return ( decorator ( f ) if f else decorator )
requires collection to be owned .