[Maypole-dev] [sri at oook.de: [PATCH] Rubberband.pm and Maypole.pm]

From: Simon Cozens (simon at simon-cozens.org)
Date: Sun Aug 29 2004 - 17:03:09 BST


Sebastian sent me the below patch. (I don't know why it didn't go to this
list.) It adds authentication to all pages, including template-only pages.

Does anyone have any thoughts on this? I remember last time I played with
this idea, I wasn't too happy with it because of this line:
         $r->model_class->process($r);
Plain templates, by definition, don't have a model class, so I never
understood how this could work.

I'm also just generally unhappy about changing the behaviour of Maypole on
things like this, since some people may actually be using it for useful
things...

----- Forwarded message from Sebastian Riedel <sri at oook.de> -----

From: Sebastian Riedel <sri at oook.de>
Subject: [PATCH] Rubberband.pm and Maypole.pm
To: Simon Cozens <simon at simon-cozens.org>
X-Enigmail-Version: 0.85.0.0
X-Enigmail-Supports: pgp-inline, pgp-mime
X-Spam-Checker-Version: SpamAssassin 2.70-r6188 (2004-01-17) on
        alibi.simon-cozens.org
X-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_00,RATWR10_MESSID,
        RCVD_IN_NJABL,RCVD_IN_SORBS autolearn=no version=2.70-r6188
X-Spam-Level:

66,78c66,68
< my $status = $r->is_applicable;
< if ($status == OK) {
< $status = $r->call_authenticate;
< if ($r->debug and $status != OK and $status != DECLINED) {
< $r->view_object->error($r,
< "Got unexpected status $status from calling authentication");
< }
< return $status unless $status == OK;
< $r->additional_data();
<
< $r->model_class->process($r);
< } else {
< # Otherwise, it's just a plain template.

---
>     my $applicable = $r->is_applicable;
>     unless ($applicable == OK) { 
>         # It's just a plain template.
82a73,85
>     # We authenticate every request, needed for proper session management
>     my $status = $r->call_authenticate;
>     if ($r->debug and $status != OK and $status != DECLINED) {
>         $r->view_object->error($r,
>             "Got unexpected status $status from calling authentication");
>     }
>     return $status unless $status == OK;
>     # We run additional_data for every request
>     $r->additional_data();
>     if ($applicable == OK) { 
>         # It's applicable
>         $r->model_class->process($r);
>     }
114,115c117,121
<     return $self->model_class->authenticate($self) if 
<         $self->model_class->can("authenticate"); 
---
>     # Check if we have a model_class
>     if ($self->{model_class}) {
>         return $self->model_class->authenticate($self) if 
>             $self->model_class->can("authenticate"); 
>     }

----- End forwarded message ----- -- Given an infinite amount of monkeys an infinite amount of time, an infinite amount of drafting supplies, and an infinite amount of crack, they'd come up with Downtown Chicago. -- David Jacoby, in the monastery

_______________________________________________ maypole-dev mailing list maypole-dev at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole-dev



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT