From a48b008f9978742b8ed8ea7e840422d6ce48bb0e Mon Sep 17 00:00:00 2001 From: mdipierro Date: Thu, 25 Oct 2012 08:22:34 -0500 Subject: [PATCH] wiki edit menu pages conditional to login --- VERSION | 2 +- gluon/tools.py | 47 ++++++++++++++++++++++++----------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/VERSION b/VERSION index 7ad8bbae..0d6e4fbc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.2.1 (2012-10-25 08:17:22) stable +Version 2.2.1 (2012-10-25 08:22:25) stable diff --git a/gluon/tools.py b/gluon/tools.py index 580d4037..e70723dd 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -5035,30 +5035,31 @@ class Wiki(object): if True: submenu = [] menu.append((current.T('[Wiki]'), None, None, submenu)) - if URL() == URL(controller, function): - if not str(request.args(0)).startswith('_'): - slug = request.args(0) or 'index' - mode = 1 - elif request.args(0) == '_edit': - slug = request.args(1) or 'index' - mode = 2 - elif request.args(0) == '_editmedia': - slug = request.args(1) or 'index' - mode = 3 - else: - mode = 0 - if mode in (2, 3): - submenu.append((current.T('View Page'), None, - URL(controller, function, args=slug))) - if mode in (1, 3): - submenu.append((current.T('Edit Page'), None, - URL(controller, function, args=('_edit', slug)))) - if mode in (1, 2): - submenu.append((current.T('Edit Page Media'), None, - URL(controller, function, args=('_editmedia', slug)))) + if self.auth.user: + if URL() == URL(controller, function): + if not str(request.args(0)).startswith('_'): + slug = request.args(0) or 'index' + mode = 1 + elif request.args(0) == '_edit': + slug = request.args(1) or 'index' + mode = 2 + elif request.args(0) == '_editmedia': + slug = request.args(1) or 'index' + mode = 3 + else: + mode = 0 + if mode in (2, 3): + submenu.append((current.T('View Page'), None, + URL(controller, function, args=slug))) + if mode in (1, 3): + submenu.append((current.T('Edit Page'), None, + URL(controller, function, args=('_edit', slug)))) + if mode in (1, 2): + submenu.append((current.T('Edit Page Media'), None, + URL(controller, function, args=('_editmedia', slug)))) - submenu.append((current.T('Create New Page'), None, - URL(controller, function, args=('_create')))) + submenu.append((current.T('Create New Page'), None, + URL(controller, function, args=('_create')))) if self.can_manage(): submenu.append((current.T('Manage Pages'), None, URL(controller, function, args=('_pages'))))