+@require_GET
+def document_detail_readonly(request, name, template_name='wiki/document_details_readonly.html'):
+ storage = getstorage()
+
+ try:
+ revision = request.GET['revision']
+ document = storage.get(name, revision)
+ except (KeyError, DocumentNotFound) as e:
+ 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,
+ })
+
+