[Grok-dev] Newbie question: adding static document at site root?
uli at gnufix.de
Tue Sep 23 19:58:03 EDT 2008
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::
which would make the file `foo.xml` located in the `somedir` directory
of your package available under the name `crossdomain.xml`.
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
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 191 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20080924/9c1a2861/attachment.bin
More information about the Grok-dev