Exemplo n.º 1
0
def test_edit_priv(rf):
    request = rf.get("/")
    request.user = SuperUser()
    request.session = {}
    assert could_edit(request)
    assert not is_edit_mode(request)
    set_edit_mode(request, True)
    assert is_edit_mode(request)
    set_edit_mode(request, False)
    assert not is_edit_mode(request)
Exemplo n.º 2
0
 def dispatch(self, request, *args, **kwargs):  # doccov: ignore
     if not could_edit(request):
         raise Problem("No access to editing")
     self._populate_vars()
     if self.default_layout:
         self.view_config.save_default_placeholder_layout(self.placeholder_name, self.default_layout)
         # We saved the default layout, so get rid of the humongous GET arg and try again
         get_args = dict(self.request.GET.items())
         get_args.pop("default_config", None)
         return HttpResponseRedirect("%s?%s" % (self.request.path, urlencode(get_args)))
     return super(EditorView, self).dispatch(request, *args, **kwargs)
Exemplo n.º 3
0
 def dispatch(self, request, *args, **kwargs):  # doccov: ignore
     if not could_edit(request):
         raise Problem(_("No access to editing"))
     self._populate_vars()
     if self.default_layout:
         self.view_config.save_default_placeholder_layout(
             self.placeholder_name, self.default_layout)
         # We saved the default layout, so get rid of the humongous GET arg and try again
         get_args = dict(self.request.GET.items())
         get_args.pop("default_config", None)
         return HttpResponseRedirect(
             "%s?%s" % (self.request.path, urlencode(get_args)))
     return super(EditorView, self).dispatch(request, *args, **kwargs)
Exemplo n.º 4
0
 def dispatch(self, request, *args, **kwargs):  # doccov: ignore
     if not could_edit(request):
         raise Problem(_("No access to editing"))
     self._populate_vars()
     if self.default_layout:
         self.view_config.save_default_placeholder_layout(self.placeholder_name, self.default_layout)
         # We saved the default layout, so get rid of the humongous GET arg and try again
         get_args = dict(self.request.GET.items())
         get_args.pop("default_config", None)
         global_type = get_args.pop("global_type", None)
         if global_type:
             get_args["view"] = XTHEME_GLOBAL_VIEW_NAME
         # We are overriding the view with XTHEME_GLOBAL_VIEW_NAME if this is a global placeholder
         return HttpResponseRedirect("%s?%s" % (self.request.path, urlencode(get_args)))
     return super(EditorView, self).dispatch(request, *args, **kwargs)