From: Bernie Innocenti Date: Fri, 8 Aug 2008 12:59:26 +0000 (+0545) Subject: Distinguish between immutable and protected pages X-Git-Tag: v3.0~11 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=bf72fca16d5042ff86328d5687810b6b5177bfcb;p=geekigeeki.git Distinguish between immutable and protected pages --- diff --git a/geekigeeki.py b/geekigeeki.py index 44be2a4..341bbad 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -110,7 +110,7 @@ def send_guru(msg_text, msg_type): } """ -def send_title(name, text="Limbo", msg_text=None, msg_type='error'): +def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=False): global title_done if title_done: return @@ -130,7 +130,7 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error'): if icon_url: print ' ' % relative_url(icon_url) - if privileged_url is not None: + if name and writable and privileged_url is not None: print ' ' \ % (privileged_path() + '?edit=' + name) @@ -141,7 +141,7 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error'): print '' # Body - if name and privileged_url is not None: + if name and writable and privileged_url is not None: print '' else: print '' @@ -155,7 +155,7 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error'): print ' ' + link_tag('?fullsearch=' + name, text, 'navlink') + ' ' else: print ' ' + text + ' ' - print ' | ' + link_tag('FrontPage', 'Front Page', 'navlink') + print ' | ' + link_tag('FrontPage', 'Home', 'navlink') print ' | ' + link_tag('FindPage', 'Find Page', 'navlink') if 'history_url' in globals(): print ' | Recent Changes' @@ -165,7 +165,11 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error'): if name: print ' | ' + link_tag('?raw=' + name, 'Raw Text', 'navlink') if privileged_url is not None: - print ' | ' + link_tag('?edit=' + name, 'Edit Page', 'navlink', privileged=True) + if writable: + print ' | ' + link_tag('?edit=' + name, 'Edit', 'navlink', privileged=True) + else: + print ' | ' + link_tag(name, 'Login', 'navlink', privileged=True) + else: print ' | Immutable Page' @@ -653,17 +657,14 @@ class Page: send_guru("Read access denied by ACLs", "notice") def format(self): - page_name = None - if self.can_write(): - page_name = self.page_name - #css foo.css bar.css global css_url css_url = self.get_attr("css", "").split() + css_url - send_title(page_name, self.split_title(), msg_text=self.msg_text, msg_type=self.msg_type) + send_title(self.page_name, self.split_title(), + msg_text=self.msg_text, msg_type=self.msg_type, writable=self.can_write()) self.send_naked() - send_footer(page_name, self._last_modified()) + send_footer(self.page_name, self._last_modified()) def _last_modified(self): try: