diff --git a/development.ini b/development.ini index c31d6653..d83a93b0 100644 --- a/development.ini +++ b/development.ini @@ -54,7 +54,7 @@ node_modules = %(NODE_PATH)s processing_settings_path = %(here)s/thinkhazard_processing.yaml -feedback_form_url = https://docs.google.com/forms/d/1m5j6e_cmpsCQftUE6NnS8UbzNs4VoZgop1D5up71YS8/viewform +feedback_form_url = https://goo.gl/forms/FX8uxUgLwDKErdFG2 # Data folder path data_path = /tmp diff --git a/production.ini b/production.ini index 62deabc7..587a0a07 100644 --- a/production.ini +++ b/production.ini @@ -53,7 +53,7 @@ node_modules = %(NODE_PATH)s processing_settings_path = %(here)s/thinkhazard_processing.yaml -feedback_form_url = https://docs.google.com/forms/d/1m5j6e_cmpsCQftUE6NnS8UbzNs4VoZgop1D5up71YS8/viewform +feedback_form_url = https://goo.gl/forms/FX8uxUgLwDKErdFG2 # Data folder path data_path = /tmp diff --git a/thinkhazard/__init__.py b/thinkhazard/__init__.py index 5758c9d2..b20c83fe 100644 --- a/thinkhazard/__init__.py +++ b/thinkhazard/__init__.py @@ -54,7 +54,7 @@ def forbidden_view(request): config.include("thinkhazard.session") config.add_tween("thinkhazard.tweens.set_secure_headers", over=MAIN) - config.add_tween("thinkhazard.tweens.notmodified_tween_factory", over=MAIN) + config.add_tween("thinkhazard.tweens.no_cache_tween_factory", over=MAIN) config.add_static_view("static", "thinkhazard:static", cache_max_age=3600) config.override_asset( @@ -153,7 +153,6 @@ def add_public_routes(config): add_localized_route(config, "index", "/") add_localized_route(config, "about", "/about") add_localized_route(config, "faq", "/faq") - add_localized_route(config, "disclaimer", "/disclaimer") def pregenerator(request, elements, kw): if "division" in kw: diff --git a/thinkhazard/templates/faq.jinja2 b/thinkhazard/templates/faq.jinja2 index def0381e..1a065b8d 100644 --- a/thinkhazard/templates/faq.jinja2 +++ b/thinkhazard/templates/faq.jinja2 @@ -5,7 +5,7 @@ gettext('General'), [ ( gettext('What is the purpose of this tool?'), - gettext('*ThinkHazard!* was designed to increase awareness of natural hazards anywhere in the world. It does so by providing a simple overview of different hazards and their ‘hazard levels’ for any given area, delivering recommendations and information to aid users in managing their risk to those hazards. The tool is designed to become increasingly comprehensive over time as users contribute new data and information. If you have data or information to contribute, please [click here](%(link)s). *ThinkHazard!* does not provide tools for detailed risk analysis. [IDF CatRiskTools](%(link2)s) provides a catalog of open access and commercially licenced risk analysis tools. Impact analysis can be conducted on data stored at [GFDRR Innovation Lab GeoNode](%(link3)s) using the new GeoSafe impact analysis tool.', link='https://goo.gl/forms/FX8uxUgLwDKErdFG2', link2='https://catrisktools.oasishub.co', link3=url_to_geonode) + gettext('*ThinkHazard!* was designed to increase awareness of natural hazards anywhere in the world. It does so by providing a simple overview of different hazards and their ‘hazard levels’ for any given area, delivering recommendations and information to aid users in managing their risk to those hazards. The tool is designed to become increasingly comprehensive over time as users contribute new data and information. If you have data or information to contribute, please [click here](%(link)s). *ThinkHazard!* does not provide tools for detailed risk analysis. [IDF CatRiskTools](%(link2)s) provides a catalog of open access and commercially licenced risk analysis tools. Impact analysis can be conducted on data stored at [GFDRR Innovation Lab GeoNode](%(link3)s) using the new GeoSafe impact analysis tool.', link=feedback_form_url, link2='https://catrisktools.oasishub.co', link3=url_to_geonode) ), ( gettext('What do the hazard levels mean?'), @@ -36,7 +36,7 @@ For any region selected by a user, *ThinkHazard!* shows the maximum hazard level ), ( gettext('Has the information in *ThinkHazard!* been peer-reviewed?'), - gettext('We commissioned an independent analysis of how well *ThinkHazard!* estimated hazard levels for up to 77 developing countries around the world and the results can be seen here. We recognize the importance of producing accurate results for our users so we are continuously looking for more accurate national and local datasets to supplement the tool. If you are aware of additional hazard datasets please contact us via the [feedback form](%(link)s), available on every page.', link='https://goo.gl/forms/FX8uxUgLwDKErdFG2') + gettext('We commissioned an independent analysis of how well *ThinkHazard!* estimated hazard levels for up to 77 developing countries around the world and the results can be seen here. We recognize the importance of producing accurate results for our users so we are continuously looking for more accurate national and local datasets to supplement the tool. If you are aware of additional hazard datasets please contact us via the [feedback form](%(link)s), available on every page.', link=feedback_form_url) ), ( gettext('Disasters don’t stop at borders or administrative boundaries. Why is *ThinkHazard!* based on (national, provincial, district) boundaries?'), @@ -44,7 +44,7 @@ For any region selected by a user, *ThinkHazard!* shows the maximum hazard level ), ( gettext('Are there more hazards in my area than are shown?'), - gettext('There may be hazards that affect your area that are not shown in *ThinkHazard!*. The tool focuses on natural hazards only, so hazards such as road traffic hazards and chemical spill hazards are not considered. Localized natural hazards such as avalanche and tornado, or those hazards that are specific to very few countries, are not presented. If there are hazards that you feel should be presented, please record this using the [feedback form](%(link)s), available on every page.', link='https://goo.gl/forms/FX8uxUgLwDKErdFG2') + gettext('There may be hazards that affect your area that are not shown in *ThinkHazard!*. The tool focuses on natural hazards only, so hazards such as road traffic hazards and chemical spill hazards are not considered. Localized natural hazards such as avalanche and tornado, or those hazards that are specific to very few countries, are not presented. If there are hazards that you feel should be presented, please record this using the [feedback form](%(link)s), available on every page.', link=feedback_form_url) ), ( gettext('A disaster recently occurred in a region with low or medium hazard. Does this mean the hazard level is wrong?'), @@ -74,15 +74,15 @@ An equivalent way of expressing return period is as the chance of occurring each ), ( gettext('Is *ThinkHazard!* available in multiple languages?'), - gettext('The tool is now available in English, French, and Spanish. We will consider additional language functionality in future development. Please let us know what language you would like to see using the [feedback form](%(link)s).', link='https://goo.gl/forms/FX8uxUgLwDKErdFG2') + gettext('The tool is now available in English, French, and Spanish. We will consider additional language functionality in future development. Please let us know what language you would like to see using the [feedback form](%(link)s).', link=feedback_form_url) ), ( gettext('I can see a use for this kind of tool in my institution and/or sector. How do I develop a customized version?'), - gettext('We’re glad you asked! Other organizations have already seen a use for this type of tool, from the occupational health and safety sector to disaster risk management professionals working on school safety. The code is open source and is designed to be tailored to different sectors and organizations. Please use the [feedback form](%(link)s) to let us know how *ThinkHazard!* could be useful to you so that we can get in touch to discuss development.', link='https://goo.gl/forms/FX8uxUgLwDKErdFG2') + gettext('We’re glad you asked! Other organizations have already seen a use for this type of tool, from the occupational health and safety sector to disaster risk management professionals working on school safety. The code is open source and is designed to be tailored to different sectors and organizations. Please use the [feedback form](%(link)s) to let us know how *ThinkHazard!* could be useful to you so that we can get in touch to discuss development.', link=feedback_form_url) ), ( gettext('What is the long-term vision for the tool?'), - gettext('We want *ThinkHazard!* to be the go-to source of information for everyone to understand their exposure to natural hazards around the world, to be a reliable source for guidance on how to reduce risk when planning projects, to be a repository of useful reports, websites, and information, and, ultimately, to be a gateway to higher resolution datasets. In order to be a useful source, the data and information that are used in the tool must continually be updated and improved. If you have relevant data or information, please use the [feedback form](%(link)s) so that we can contact you to discuss.', link='https://goo.gl/forms/FX8uxUgLwDKErdFG2') + gettext('We want *ThinkHazard!* to be the go-to source of information for everyone to understand their exposure to natural hazards around the world, to be a reliable source for guidance on how to reduce risk when planning projects, to be a repository of useful reports, websites, and information, and, ultimately, to be a gateway to higher resolution datasets. In order to be a useful source, the data and information that are used in the tool must continually be updated and improved. If you have relevant data or information, please use the [feedback form](%(link)s) so that we can contact you to discuss.', link=feedback_form_url) ), ], ), @@ -90,19 +90,19 @@ An equivalent way of expressing return period is as the chance of occurring each gettext('Improvements and suggestions'), [ ( gettext('Can I provide suggestions to the tool or to the recommendations?'), - gettext('Yes! We continue to improve the tool and want to know what you think. Tell us [here](%(link)s).', link='https://goo.gl/forms/FX8uxUgLwDKErdFG2') + gettext('Yes! We continue to improve the tool and want to know what you think. Tell us [here](%(link)s).', link=feedback_form_url) ), ( gettext('I have relevant information. Can I contribute this to the tool?'), - gettext('Yes! We are always looking for information and hazard data that is relevant to *ThinkHazard!* users and encourage you to tell us what you could provide using the [feedback form](%(link)s), and we will follow up directly with you. Your institution will be credited as the source of data.', link='https://goo.gl/forms/FX8uxUgLwDKErdFG2') + gettext('Yes! We are always looking for information and hazard data that is relevant to *ThinkHazard!* users and encourage you to tell us what you could provide using the [feedback form](%(link)s), and we will follow up directly with you. Your institution will be credited as the source of data.', link=feedback_form_url) ), ( gettext('How can I report an error in data or recommendations?'), - gettext('Please let us know about it using the [feedback form](%(link)s) so that we can try to fix it. Thanks for letting us know, we need your help to constantly improve *ThinkHazard!*.', link='https://goo.gl/forms/FX8uxUgLwDKErdFG2') + gettext('Please let us know about it using the [feedback form](%(link)s) so that we can try to fix it. Thanks for letting us know, we need your help to constantly improve *ThinkHazard!*.', link=feedback_form_url) ), ( gettext('Can I get more specific recommendations relevant to my type of project?'), - gettext('This version of *ThinkHazard!* is designed to be generic, and recommendations are not tailored to any particular sector or project type. If you would like to design a sector- or organization-specific tool (e.g., an education sector tool could provide recommendations on school construction), please contact us using the [feedback form](%(link)s) to discuss development. The code is open source, available on %(github_link)s, and is designed to be tailored to sector or organization.', link='https://goo.gl/forms/FX8uxUgLwDKErdFG2', github_link='[Github](https://github.com/GFDRR/thinkhazard)') + gettext('This version of *ThinkHazard!* is designed to be generic, and recommendations are not tailored to any particular sector or project type. If you would like to design a sector- or organization-specific tool (e.g., an education sector tool could provide recommendations on school construction), please contact us using the [feedback form](%(link)s) to discuss development. The code is open source, available on %(github_link)s, and is designed to be tailored to sector or organization.', link=feedback_form_url, github_link='[Github](https://github.com/GFDRR/thinkhazard)') ), ], ), @@ -130,7 +130,7 @@ For non-probabilistic data, such as landslide susceptibility index, we categoriz ), ( gettext('The hazard data seem to contradict other data I have seen or used. Why is this?'), - gettext('It is difficult for us to know the cause of the discrepancy without further information. *ThinkHazard!* uses a variety of hazard data sources. If you have any data that is relevant to hazard levels, [please let us know](%(link)s) so that we can use it to improve the information on *ThinkHazard!*.', link='https://goo.gl/forms/FX8uxUgLwDKErdFG2" target="_blank">') + gettext('It is difficult for us to know the cause of the discrepancy without further information. *ThinkHazard!* uses a variety of hazard data sources. If you have any data that is relevant to hazard levels, [please let us know](%(link)s) so that we can use it to improve the information on *ThinkHazard!*.', link=feedback_form_url) ), ( gettext('How does *ThinkHazard!* account for permanent water bodies in river flood hazard?'), diff --git a/thinkhazard/tweens.py b/thinkhazard/tweens.py index fbcc4a8e..65fd7257 100644 --- a/thinkhazard/tweens.py +++ b/thinkhazard/tweens.py @@ -22,7 +22,6 @@ import secure from pyramid.response import Response from pyramid.renderers import render -from pyramid.httpexceptions import HTTPNotModified from .models import Publication @@ -82,13 +81,13 @@ def tween(request, secure_headers): return tween -def notmodified_tween_factory(handler, registry): +def no_cache_tween_factory(handler, registry): if registry.settings["appname"] == "public": gmt = pytz.timezone("GMT") - def notmodified_tween(request): + def public_tween(request): if request.path == "/healthcheck": return handler(request) @@ -99,19 +98,13 @@ def notmodified_tween(request): response.status_code = 503 return response - if ( - request.if_modified_since is not None - and request.if_modified_since >= publication_date.replace(microsecond=0) - ): - return HTTPNotModified() - request.publication_date = publication_date response = handler(request) - response.last_modified = publication_date + response.cache_expires(0) return response - return notmodified_tween + return public_tween if registry.settings["appname"] == "admin": diff --git a/thinkhazard/views/index.py b/thinkhazard/views/index.py index f107fa31..31ef9ce1 100644 --- a/thinkhazard/views/index.py +++ b/thinkhazard/views/index.py @@ -44,18 +44,16 @@ def about(request): return { "publication_date": ( publication_date.date.strftime("%c") if publication_date else "" - ) + ), + "feedback_form_url": request.registry.settings["feedback_form_url"], } @view_config(route_name="faq", renderer="templates/faq.jinja2") def faq(request): - return {} - - -@view_config(route_name="disclaimer", renderer="templates/disclaimer.jinja2") -def disclaimer(request): - return {"feedback_form_url": request.registry.settings["feedback_form_url"]} + return { + "feedback_form_url": request.registry.settings["feedback_form_url"], + } @view_config(route_name="data_map", renderer="templates/data_map.jinja2")