The URL() function automatically uses the extension of the current request 
(i.e., request.extension) unless explicitly overridden or suppressed. You 
can suppress the extension via URL(..., extension=False). See the very end 
of this section in the 
book: http://web2py.com/books/default/chapter/29/4#URL.

Anthony

On Tuesday, March 20, 2012 10:40:18 AM UTC-4, weheh wrote:
>
> I got into this pickle because I was using a URL(c='static', 
> f='images', ...) to download an image under static/images. The problem 
> was that the image download was taking place from a component, so a 
> ".load" suffix was getting spliced into the middle of the path like 
> this: 
>
>     IMG(_src='myapp/static/images.load/...') 
>
> I figured I'd just get around the ".load" by building the path on my 
> own using os.path.join(request.folder,'static/images/...') and that's 
> when I saw that request.folder was getting stripped of its slashes (or 
> backslashes ... I don't recall at this moment). 
>
> Anyway, I backtracked and decided to just .replace('.load','') on the 
> URL(), even though that seems awfully ugly. 
>
> Bottom line, URL() is inserting a ".load" on the path during the ajax 
> callback after doing a form submit. BUT there is NO ".load" in the 
> same path when just loading the page the first time. I think this is 
> inconsistent behavior, but I don't have the time to delve deeper into 
> it at this time. 
>
>
> On Mar 20, 10:28 pm, Jonathan Lundell <[email protected]> wrote: 
> > On Mar 20, 2012, at 6:54 AM, weheh wrote: 
> > 
> > 
> > 
> > > Ah ... never mind. This seems to be a "\" quoting problem, but one 
> > > I've never encountered before. It's biting me in an ajax callback 
> > > routine. It looks like I may have to quote a bunch of "\"s and now I'm 
> > > just trying to figure out how many I have to quote. 
> > 
> > Can't you use '/'? Or translate to '/'? 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > On Mar 20, 9:41 pm, weheh <[email protected]> wrote: 
> > >> I'm seeing an odd behavior ... request.folder has lost all the "/" 
> > >> marks in the path. 
> > 
> > >> During page load, request.folder has the proper "/" marks, as in: 
> > 
> > >>     N:/web2py/applications/myapp 
> > 
> > >> but later, during a callback script, the "/" marks have been 
> stripped, 
> > >> as in: 
> > 
> > >>     N:web2pyapplicationsmyapp 
> > 
> > >> In between, I can't find anywhere that I touched it. 
> > 
> > >> Anyone have any thoughts about what could possibly be causing that?

Reply via email to