changeset 816:3bfe393013e9 pytest2

merged with default - had got two extra heads one from pytest2 and other from default
author pkumar <contactprashantat@gmail.com>
date Wed, 24 Aug 2011 09:17:48 +0530
parents 185f64deed0f (current diff) 6d0ab44672d7 (diff)
children de75a93b21fe
files
diffstat 2 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Wed Aug 24 09:15:57 2011 +0530
+++ b/MoinMoin/apps/frontend/views.py	Wed Aug 24 09:17:48 2011 +0530
@@ -1,5 +1,6 @@
 # Copyright: 2003-2010 MoinMoin:ThomasWaldmann
 # Copyright: 2011 MoinMoin:AkashSinha
+# Copyright: 2011 MoinMoin:ReimarBauer
 # Copyright: 2008 MoinMoin:FlorianKrupicka
 # Copyright: 2010 MoinMoin:DiogenesAugusto
 # Copyright: 2001 Richard Jones <richard@bizarsoftware.com.au>
@@ -80,6 +81,7 @@
 Disallow: /+download/
 Disallow: /+modify/
 Disallow: /+copy/
+Disallow: /+content/
 Disallow: /+delete/
 Disallow: /+ajaxdelete/
 Disallow: /+ajaxdestroy/
@@ -280,6 +282,25 @@
                            show_navigation=show_navigation,
                           )
 
+@frontend.route('/+content/<int:rev>/<itemname:item_name>')
+@frontend.route('/+content/<itemname:item_name>', defaults=dict(rev=-1))
+def content_item(item_name, rev):
+    """ same as show_item, but we only show the content """
+    # first check whether we have a valid search query:
+    search_form = SearchForm.from_flat(request.values)
+    if search_form.validate():
+        return _search(search_form, item_name)
+    search_form['submit'].set_default() # XXX from_flat() kills all values
+    item_displayed.send(app._get_current_object(),
+                        item_name=item_name)
+    try:
+        item = Item.create(item_name, rev_no=rev)
+    except AccessDeniedError:
+        abort(403)
+    return render_template('content.html',
+                           item_name=item.name,
+                           data_rendered=Markup(item._render_data()),
+                           )
 
 @frontend.route('/+get/<int:rev>/<itemname:item_name>')
 @frontend.route('/+get/<itemname:item_name>', defaults=dict(rev=-1))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/templates/content.html	Wed Aug 24 09:17:48 2011 +0530
@@ -0,0 +1,9 @@
+{% extends "base.html" %}
+{% block layout %}
+{% if data_rendered %}
+    <div id="moin-content-data">
+    {{ data_rendered }}
+    <div>
+{% endif %}
+{% endblock %}
+