Mercurial > wikked
changeset 472:dbe22d170cf7
web: Don't offer to create a missing page when in a read-only endpoint.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 08 Oct 2018 23:46:08 -0700 |
parents | b5b0eb75f980 |
children | 93d84f2c2b31 |
files | wikked/templates/read-page-missing.html wikked/views/read.py |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/wikked/templates/read-page-missing.html Mon Oct 08 23:43:30 2018 -0700 +++ b/wikked/templates/read-page-missing.html Mon Oct 08 23:46:08 2018 -0700 @@ -17,10 +17,14 @@ {% endif %} </header> <section class="content"> + {% if not is_readonly %} <p>This page doesn't exist yet. You can <a class="wiki-link missing" data-wiki-url="{{meta.url}}" href="{{get_edit_url(meta.url)}}">create it now</a>. </p> + {% else %} + <p>This page doesn't exist, and can't be created.</p> + {% endif %} </section> </article> {% endblock %}
--- a/wikked/views/read.py Mon Oct 08 23:43:30 2018 -0700 +++ b/wikked/views/read.py Mon Oct 08 23:46:08 2018 -0700 @@ -21,9 +21,15 @@ def _make_missing_page_data(url): + is_readonly_endpoint = False endpoint, path = split_page_url(url) + if endpoint: + epinfo = get_wiki().getEndpoint(endpoint) + is_readonly_endpoint = (epinfo is not None and epinfo.readonly) + data = { 'endpoint': endpoint, + 'is_readonly': is_readonly_endpoint, 'meta': { 'url': url, 'title': make_page_title(path) @@ -37,6 +43,7 @@ def read(url): wiki = get_wiki() url = url_from_viewarg(url) + user = current_user.get_id() no_redirect = 'no_redirect' in request.args tpl_name = 'read-page.html'