[Grok-dev] Newbie question: adding static document at site root?
floydophone at gmail.com
Tue Sep 23 23:32:02 EDT 2008
Thanks everyone - the ZMI solution was what I was looking for, but I had
already taken Sebastian's advice and now I'm serving everything behind
nginx, which was easier than I thought it would be.
On Tue, Sep 23, 2008 at 7:58 PM, Uli Fouquet <uli at gnufix.de> wrote:
> Hi there,
> Pete Hunt wrote:
> > I'm developing a Flash/Flex application which communicates with Grok
> > via AMF. The problem is, in order for the security to work, I need to
> > add a crossdomain.xml file to the site root
> > (http://host/crossdomain.xml). Unfortunately, I can only create views
> > off of my application's path (http://host/myapp/blah), and I can't for
> > the life of me figure out how to add a static file via the ZMI to the
> > site root.
> Michael told you already how to add a File-object to the root folder
> using the ZMI. There are, however, also some non-ZMI ways available.
> You could register a file in your `configure.zcml` like this::
> name="crossdomain.xml" />
> which would make the file `foo.xml` located in the `somedir` directory
> of your package available under the name `crossdomain.xml`.
> The URLs
> would then deliver foo.xml with the correct filetype etc.
> Another, 'dirtier', approach would be to define a new view on root
> folders in your Grok application like this::
> from zope.app.folder.interfaces import IRootFolder
> import grok
> class Crossdomain(grok.View):
> def render(self):
> 'text/xml; charset=UTF-8')
> return "<doc>Some XML</doc>"
> Here you could get the file contents like this::
> which is the short form for
> Given you have no object named 'crossdomain.xml' in your root folder,
> the short form would return your view, i.e. your XML content. Hm, there
> are even more approaches, but that may help for now.
> Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Grok-dev