+@require_GET
+@normalized_name
+def editor_readonly(request, name, template_name='wiki/document_details_readonly.html'):
+ name = normalize_name(name)
+ storage = getstorage()
+
+ try:
+ revision = request.GET['revision']
+ document = storage.get(name, revision)
+ except (KeyError, DocumentNotFound):
+ raise http.Http404
+
+ access_time = datetime.now()
+ last_documents = request.session.get("wiki_last_docs", {})
+ last_documents[name] = access_time
+
+ if len(last_documents) > MAX_LAST_DOCS:
+ oldest_key = min(last_documents, key=last_documents.__getitem__)
+ del last_documents[oldest_key]
+ request.session['wiki_last_docs'] = last_documents
+
+ return direct_to_template(request, template_name, extra_context={
+ 'document': document,
+ 'document_name': document.name,
+ 'document_info': dict(document.info(), readonly=True),
+ 'document_meta': document.meta,
+ 'REDMINE_URL': settings.REDMINE_URL,
+ })
+
+
+@normalized_name
+def create_missing(request, name):