Last active
August 29, 2015 13:57
-
-
Save hadrien/9746283 to your computer and use it in GitHub Desktop.
/crossdomain.xml with pyramid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyramid.path import AssetResolver | |
from pyramid.response import Response | |
from pyramid.view import view_config | |
@view_config(name="crossdomain.xml") | |
def crossdomain_view(request): | |
"""View for the crossdomain.xml file. | |
Its sole purpose is to serve static/crossdomain.xml as | |
http://myapp/crossdomain.xml (Flash only looks for cross-domain policies at | |
the root of the server). | |
""" | |
resolver = AssetResolver() | |
asset = resolver.resolve("<package_name>:static/crossdomain.xml") | |
response = Response(content_type="text/xml") | |
response.app_iter = asset.stream() | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment