I would just abort with “redirect”. If they want the location, they can call [headers set Location] to get it.
> On Dec 15, 2014, at 3:09 PM, Massimo Manghi <[email protected]> wrote: > > Oh great thanks, I'm going to put in trunk and branches/2.2 right away. > > starting with 2.1 IIRC ::rivet::abort_page supports an optional code as > argument, so that any AbortScript can figure out what caused the page to > abort. Any Tcl object could work as argument (even a dictionary). Do you > have suggestion? > > -- Massimo > > On 12/15/2014 06:51 PM, Damon Courtney wrote: >> Don’t worry, I got it. :) And, I agree. I didn’t realize parse was doing a >> flush of the output. We should fix that. >> >> I also agree that redirect should cause an abort (or something like >> it). I already do that in my own code, as it makes no sense to >> redirect and then keep processing. It could potentially cause some >> seriously confusing bugs. We could be more elegant about it in the C >> code, but here’s a version of the proc I use we could include: >> >> proc ::rivet::redirect {url {permanent 0}} { >> no_body ; ## don’t output anything on a redirect >> headers set Location $url >> headers numeric [expr {$permanent ? "301" : "302"}] >> abort_page ; ## stop any further processing >> } >> >> Damon >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
