Re: How to render external Images/GIFs using CherryPy?

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.cherrypy
Organization Providenza & Boekelheide, Inc.
Message-ID <[email protected]>
Tejas Dharamsi wrote:
>
> I'm developing an application where the server code would generate the
> path to a GIF to be displayed.
>
> I'm using MAC OSX, how do I configure/ enable external files to be
> located by the browser.

Well, the phrase "external files" is a bit deceiving.  The browser
doesn't know anything other than URLs.  It has absolutely no access to
or understanding of the file system on the server.  It's up to your
application to translate between the two.

So, you can move (or link) the GIF into one of the static directories
your application exposes, or you can generate a URL that your CherryPy
application can translate into a filename.  This is not exactly how I'd
do it, but you can imagine if you wanted to expose
/home/mine/Pictures/Hawaii/sunset.gif, you could expose a URL like
http://mydomain.com/myapplication/pictures/home-mine-Pictures-Hawaii-sunset.gif
.  Now, in your application, you could have a handler for "pictures"
that translates the path.

The danger in that kind of scheme is hacks like
http://mydomain.com/myapplication/pictures/etc-passwd.

-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.