def default_access_fn(user, url_name, url_args=None, url_kwargs=None):
 exception = ImproperlyConfigured("Please follow Oscar's default dashboard app layout or set a custom access_fn")
 if (url_name is None):
  return True
 try:
  url = reverse(url_name, args=url_args, kwargs=url_kwargs)
  view_module = resolve(url).func.__module__
 except (NoReverseMatch, Http404):
  return False
 match = re.search('(dashboard[\\w\\.]*)\\.views$', view_module)
 if (not match):
  raise exception
 app_label_str = (match.groups()[0] + '.app')
 try:
  app_instance = get_class(app_label_str, 'application')
 except AppNotFoundError:
  raise exception
 if (':' in url_name):
  view_name = url_name.split(':')[1]
 else:
  view_name = url_name
 permissions = app_instance.get_permissions(view_name)
 return check_permissions(user, permissions)

def default_access_fn ( user , url_name , url_args = None , url_kwargs = None ) : exception = ImproperlyConfigured ( "Please follow Oscar's default dashboard app layout or set a custom access_fn" ) if ( url_name is None ) : return True try : url = reverse ( url_name , args = url_args , kwargs = url_kwargs ) view_module = resolve ( url ) . func . __module__ except ( NoReverseMatch , Http404 ) : return False match = re . search ( '(dashboard[\\w\\.]*)\\.views$' , view_module ) if ( not match ) : raise exception app_label_str = ( match . groups ( ) [ 0 ] + '.app' ) try : app_instance = get_class ( app_label_str , 'application' ) except AppNotFoundError : raise exception if ( ':' in url_name ) : view_name = url_name . split ( ':' ) [ 1 ] else : view_name = url_name permissions = app_instance . get_permissions ( view_name ) return check_permissions ( user , permissions )
given a url_name and a user .