On 9/12/05, Dave Howorth <[EMAIL PROTECTED]> wrote:
> David Baird wrote:
> > On 9/12/05, Peter Speltz <[EMAIL PROTECTED]> wrote:
> >
> >>Another case, say you wanted images to display only if a user was over
> >>18 .  How, from the authenticate sub, would you skip Maypole
> >>processing yet tell  Apache to not return the image?  . Return ERROR?
> >
> > If you set the template, the model phase won't be run, and your
> > alternate template will replace the image. Your 'template' would need
> > to be an image as well, because the browser asked for something in an
> > 'img' tag.
> 
> Ermm? What stops the model being processed is $applicable != OK (which
> is as a result of is_applicable() and which also sets the template).
> 

Setting the template doesn't stop process() being called on the model
class, but the first thing process() does is check if a template has
been set already, and if so, it just returns.


> > Or, your authenticate() could return an AUTH_REQUIRED or FORBIDDEN
> > error and the code will be returned to the browser. (You'll need to
> > import these constants from somewhere).
> 
> How does this work? Maypole clearly isn't expecting anything but OK or
> DECLINED (which is the same numerical value as ERROR) because of these
> lines in Maypole.pm:
> 
>      if ( $r->debug and $status != OK and $status != DECLINED ) {
>          $r->view_object->error( $r,
>            "Got unexpected status $status from calling authentication" );
> 

Yes, but note there's no return call there. So the view object will
generate some output, and then we drop back to the next statement
in handler_guts(), which is 

return $status unless $status == OK;

So your non-Maypole return code is preserved, at least for custom
authentication. Note that if debug is turned off, the stanza you quote
is skipped entirely, and the status returned from call_authenticate is
returned immediately.

> And whenever I make authenticate return anything other than OK, the
> browser displays 500 - server error. Is this a CGI::Maypole problem or
> do you see the same with mod_perl?

Hmm, from a quick scan of my code, I don't return AUTH_REQUIRED, I
just redirect to the login page and return OK. I'll play around with
that.

d.


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Maypole-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-users

Reply via email to