from functools import wraps


def allowSidebar(fun):
  """Decorator that allows access if the sidebar is calling.
  """


  @wraps(fun)
  def wrapper(self, django_args, *args, **kwargs):
    """Decorator wrapper method.
    """
    if django_args.get('SIDEBAR_CALLING'):
      return
    return fun(self, django_args, *args, **kwargs)
  return wrapper