commit/galaxy-central: dannon: Fix default static wrapping to work with favicon.ico and robots.txt (and other static files that may need to be mapped to / in the future)
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/ad9a6d8afded/ changeset: ad9a6d8afded user: dannon date: 2011-12-13 16:42:38 summary: Fix default static wrapping to work with favicon.ico and robots.txt (and other static files that may need to be mapped to / in the future) affected #: 3 files diff -r d00337a396ffd79e78ed38b9365e66d055b1cfc4 -r ad9a6d8afded63469e07cd5ef89098c9c6195f22 lib/galaxy/web/buildapp.py --- a/lib/galaxy/web/buildapp.py +++ b/lib/galaxy/web/buildapp.py @@ -251,6 +251,7 @@ urlmap["/static/scripts"] = Static( conf.get( "static_scripts_dir" ), cache_time ) urlmap["/static/style"] = Static( conf.get( "static_style_dir" ), cache_time ) urlmap["/favicon.ico"] = Static( conf.get( "static_favicon_dir" ), cache_time ) + urlmap["/robots.txt"] = Static( conf.get( "static_robots_txt" ), cache_time ) # URL mapper becomes the root webapp return urlmap diff -r d00337a396ffd79e78ed38b9365e66d055b1cfc4 -r ad9a6d8afded63469e07cd5ef89098c9c6195f22 lib/galaxy/web/framework/middleware/static.py --- a/lib/galaxy/web/framework/middleware/static.py +++ b/lib/galaxy/web/framework/middleware/static.py @@ -19,6 +19,12 @@ def __call__( self, environ, start_response ): path_info = environ.get('PATH_INFO', '') if not path_info: + #See if this is a static file hackishly mapped. + if os.path.exists(self.directory) and os.path.isfile(self.directory): + app = fileapp.FileApp(self.directory) + if self.cache_seconds: + app.cache_control( max_age = int( self.cache_seconds ) ) + return app(environ, start_response) return self.add_slash(environ, start_response) if path_info == '/': # @@: This should obviously be configurable @@ -45,6 +51,6 @@ if self.cache_seconds: app.cache_control( max_age = int( self.cache_seconds ) ) return app(environ, start_response) - + def make_static( global_conf, document_root, cache_seconds=None ): - return CacheableStaticURLParser( document_root, cache_seconds ) \ No newline at end of file + return CacheableStaticURLParser( document_root, cache_seconds ) diff -r d00337a396ffd79e78ed38b9365e66d055b1cfc4 -r ad9a6d8afded63469e07cd5ef89098c9c6195f22 universe_wsgi.ini.sample --- a/universe_wsgi.ini.sample +++ b/universe_wsgi.ini.sample @@ -247,6 +247,7 @@ static_favicon_dir = %(here)s/static/favicon.ico static_scripts_dir = %(here)s/static/scripts/ static_style_dir = %(here)s/static/june_2007_style/blue +static_robots_txt = %(here)s/static/robots.txt # -- Advanced proxy features Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket