[Grok-dev] Newbie question: adding static document at site root?
faassen at startifact.com
Wed Sep 24 10:37:52 EDT 2008
Pete Hunt wrote:
> Hi -
> 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.
> Any help would be much appreciated!
Besides using the ZMI, you could also create an view for your actual
root, implement its render() method and let that return the open file,
something like this:
return open('mystaticfile', 'rb')
What to fill in for grok.context() is the challenge here, that's the
from zope.app.folder.interfaces import IRootFolder
so it's going to be grok.context(IRootFolder)
The benefit of doing this in code is that it will be shippable with your
application without you having to instruct people to use the ZMI.
More information about the Grok-dev