def must_have_write_permission_or_public_wiki(func):
 @functools.wraps(func)
 def wrapped(*args, **kwargs):
  _inject_nodes(kwargs)
  wiki = kwargs['node'].get_addon('wiki')
  if (wiki and wiki.is_publicly_editable):
   return func(*args, **kwargs)
  else:
   return must_have_permission('write')(func)(*args, **kwargs)
 return wrapped

def must_have_write_permission_or_public_wiki ( func ) : @ functools . wraps ( func ) def wrapped ( * args , ** kwargs ) : _inject_nodes ( kwargs ) wiki = kwargs [ 'node' ] . get_addon ( 'wiki' ) if ( wiki and wiki . is_publicly_editable ) : return func ( * args , ** kwargs ) else : return must_have_permission ( 'write' ) ( func ) ( * args , ** kwargs ) return wrapped
checks if user has write permission or wiki is public and publicly editable .