On Dec 29, 2010, at 3:25 PM, mattynoce wrote:
> 
> hi all. i have a component i'm plugging into the middle of a page, but
> i want that component to act seamlessly with the rest of the page. i
> do NOT want the component to do what components usually do and act
> independently. i need to include variable files, and components are
> the only way i can find to do that.
> 
> so when i submit forms from the component, they automatically
> append .load to redirects. i do not want this. so i found i can do:
> redirect(URL(..., extension=''))
> 
> however, when i execute other commands like this:
> def formControllerFromComponent:
>    doSomething()
>    doSomethingElse()
>    redirect(URL(..., extension=''))
> 
> doSomething() will create any links it makes with a .load extension. i
> don't want to have to go around and append extension='' to every URL
> command in my controller. is there a way we can stop propagation of
> the .load suffix? based on a variable in the load initialization?
> something like:
> {{=LOAD(c='default', f='func', args=[arg1, arg2], ajax=False,
> ajax_trap=False, loadPropagate=False)}}

This is a slightly tricky "feature". The propagation of the .load extension (or 
any extension) depends on how URL() is called. I think it's a problem in the 
way _gURL was implemented, and it makes URL even more hard to understand than 
it already was.

The issue is that URL defaults to request.extension (among other things) if 
request is passed to URL. And request is implicitly passed to URL if you call 
URL(func) or URL(ctlr, func) -- but *not* if you call URL(app, ctlr, func). And 
of course you can override extension with extension=something (as long as 
'something' isn't None).

We don't ordinarily care about this propagation, because 'html', the default, 
is almost always what we want. 

URL is already so tricky in the way it works that I'd be really wary of 
changing it; it'd almost certainly break something for someone. I haven't used 
LOAD, and I'm a little hazy on how it works, but perhaps we could change some 
central load handler to set request.extension=None, or something like that. I 
think that'd be reasonable, since a new load request would set the extension 
explicitly.

Reply via email to