On 9/12/05, Dave Howorth <[EMAIL PROTECTED]> wrote:
> David Baird wrote:
> 
> > 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.
> 
> You're quite right. Yet another place in Maypole where you can't
> actually follow the logic by reading the code in one place :(  I wonder
> why that test is in model->process while the rest of it is in handler_guts?

Good point, we should move it. I've added a bug report to rt.

[ snip ]

> Sorry, that wasn't my point. If you don't have debug turned on, the view
> object won't get called there. My point was just that the guard
> condition only allowed for OK and DECLINED (what is DECLINED, BTW, since
> it's numerically equal to ERROR?)
> 

Another MM (Maypole Mystery). I think what's happening is that the
ERROR/DECLINED return code is being used as a general mechanism of
signalling an exception, but once the exception is detected, the range
of return values (i.e. it's -1 or it's -1) isn't rich enough to give
any useful information about what to do next. If we had a more general
exception system, where models could throw exception objects, then we
could deal with different conditions better. For example, Mason
handles redirects by throwing a redirect error. Everything gets
dumped, redirect headers are set, and the handler immediately returns.

> > 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.
> 
> Exactly! So you get a 500.

No, you get whatever your custom authenticate() method returns. Am I
missing something here? I guess I'll have to actually run some code.

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