durusmail: quixote-users: altdemo to also show form-based login and page access control
altdemo to also show form-based login and page access control
2005-02-28
Mario Ruggier (2 parts)
2005-02-28
altdemo to also show form-based login and page access control
2005-02-28
2005-03-01
2005-03-01
2005-03-01
2005-03-01
2005-03-01
2005-03-01
2005-03-01
altdemo to also show form-based login and page access control
Oscar Rambla
2005-03-01
On Tuesday 01 March 2005 04:48, David Binger wrote:

> Here's what we have instead of using NotLoggedInError.
> I think the behavior the client sees is similar to what you describe
> below,
> in that there is no special login url.
> We just call ensure_signed_in() anywhere where we are about to
> expose information that requires authentication.
>
> def ensure_signed_in(msg="Please sign in."):
>      import dulcinea.ui.user.signin
>      if not get_user():
>          page = dulcinea.ui.user.signin.SignIn().form(login_reason=msg)
>          if not get_user():
>              get_response().set_body(page)
>              get_publisher().respond_now() # raises RespondNow,
>
> We have similar, but simpler functions "not_found()",
> "invalid_query()", and "redirect()", all
> of which set the response body, status, and headers as needed, and then
> raise RespondNow.
> Quixote doesn't need to have any knowledge about particular
> application-level exceptions.
>

One thing that dislikes me from the previous example is that it's not clear
that we are interrupting the execution at that point, and worse when more
user defined functions/redirections are added.

A possible solution, I guess, could be :
              return get_publisher().respond_now()

but I think I would prefer a more explicit:
       raise Respond(body),
       raise Redirection(path)
.

-Oscar Rambla

reply