1. Felix Friedrich
  2. moin-themes

Commits

Felix Friedrich  committed 2cbf3e5 Draft

fixed attribute errors removed unnecessary tabs

  • Participants
  • Parent commits fc24ba7
  • Branches attribute_error_fixes

Comments (2)

  1. Thomas Waldmann

    hi felix,

    although i am not the owner of this repo, I got a notification and had a look.

    Your changes look OK (thanks!), I just have following comments: - maybe separate pure whitespace changes from other changes (in a different changeset) - not sure if creating branches for minor changes make sense - maybe support for stoneage moins should be removed from the themes. everything older than 1.9 is considered unmaintained / unsupported by moin development.

    I'll let the owner of this repo / maintainer of the themes do the approval. In case nothing happens, contact me.

    Cheers, Thomas

  2. Felix Friedrich author

    Moin Thomas,

    It wasn't my intention to commit these whitespace changes, but my editor (vim) automatically removed this whitespace and I wasn't able to tell the editor it shoud not do that. The Moin I used is 1.9.6 with Python 2.6.6 (Debian).

    Felix

Files changed (1)

File simplemente/simplemente.py

View file
  • Ignore whitespace
 """
     MoinMoin Simplemente theme
 
-    XXX ToDo    
+    XXX ToDo
     Provide translations for:
     * _('Recently viewed pages')
     * _('Jump directly to the page content')
     Simplemente theme
     @copyright: 2007 by Eduardo Mercovich and Oliver Siemoneit
     @license: GNU GPL, see COPYING for details.
-    
+
 """
 
 from MoinMoin import wikiutil
 
     ##
     ## Sidepanels
-    ##    
+    ##
 
     def wikipanel(self, d):
         """ Create wiki panel """
             u'</div>',
             ]
         return u'\n'.join(html)
-    
+
     def pagepanel(self, d):
         """ Create page panel """
         _ = self.request.getText
                 u'</div>',
                 ]
             return u'\n'.join(html)
-        return ''   
-        
+        return ''
+
     def userpanel(self, d):
         """ Create user panel """
         _ = self.request.getText
 
     ##
     ## Header and footer stuff
-    ##    
+    ##
 
     def header(self, d):
         """
         Assemble page header
-        
+
         @param d: parameter dictionary
         @rtype: string
         @return: page header html
             u'<a name="metanav" id="metanav" title="%s">' % _('Main navigation>'),
             u'<img src="%s" width="0" height="0" alt="">' % dummy,
             u'</a>',
-            u'</div>',			
+            u'</div>',
             # Skip links
             u'<div class="help">',
             u'<ul>',
             self.emit_custom_html(self.cfg.page_header2),
 	    ]
         return u'\n'.join(html)
-    
+
     def editorheader(self, d):
         """
         Assemble page header for editor
 
         XXX ToDo: Check skip links according to your wiki settings, i.e. if editlock is turned on, enable the
                   the skip link "jump directly to the input field".
-        
+
         @param d: parameter dictionary
         @rtype: string
         @return: page header html
             u'<a name="metanav" id="metanav" title="%s">' % _('Main navigation>'),
             u'<img src="%s" width="0" height="0" alt="">' % dummy,
             u'</a>',
-            u'</div>',			
+            u'</div>',
             # Skip links
             u'<div class="help">',
             u'<ul>',
 
     def footer(self, d, **keywords):
         """ Assemble page footer
-        
+
         @param d: parameter dictionary
         @keywords: not used currently
         @rtype: string
             self.pagepanel(d),
             self.endPage(),
             u'</div>',
-                       
+
             # Sidebars
             u'<div id="sidebar">',
             self.wikipanel(d),
         Changed: - ImmutablePage added to the end of page name if page is not writeable
                  - Virtual page of an action causes a new crumb and is appended to the
                    end (i.e. to the underlying current wikipage)
-        
+
         @param d: parameter dictionary
         @rtype: string
         @return: title html
 
         link_text = segments[-1]
         # Check whether an action has created a virtual page. No backlinking in this case.
-        if d['title_text'] == d['page_name']: 
+        if d['title_text'] == d['page_name']:
             link_title = _('Click to do a full-text search for this title')
             link_query = {
                 'action': 'fullsearch',
             content.append(' / %s' % link)
         else:
             content.append('%s' % link)
-            
+
         # Check whether page ist writeable. If not: add a note on that
         if not (d['page'].isWritable() and self.request.user.may.write(d['page'].page_name)):
             content.append(' (%s)' % _('Immutable Page', formatted=False))
 
         # Check whether an action has created a virtual page e.g. "Diff for..". Add this virtual page to the end of the breadcrumb navigation.
-        if d['title_text'] != d['page_name']: 
+        if d['title_text'] != d['page_name']:
             content.append(' / %s' % wikiutil.escape(d['title_text']))
 
         html = '''
                  common/js/common.js
         """
         # Check for version: prefix for the static stuff has been changed in Moin1.6
-        if self.cfg.url_prefix: # prior Moin1.6
+        if hasattr(self.cfg, 'url_prefix'): # prior Moin1.6
             src = '%s/simplemente/js/%s.js' % (self.cfg.url_prefix, name)
         else:                   # we are on Moin1.6
             src = '%s/simplemente/js/%s.js' % (self.cfg.url_prefix_static, name)
 //-->
 </script>
 """ % { 'search_hint': _('Search', formatted=False), }
-        
+
         # GoogleAnalytics stuff
         if hasattr(self.request.cfg, 'google_analytics_account_number'):
             account_number = self.request.cfg.google_analytics_account_number
         # Accesskey customization
         user = self.request.user
         content = ''
-        if user.valid and user.name: 
+        if user.valid and user.name:
             homewiki, homepage = wikiutil.getInterwikiHomePage(self.request)
             # We don't support interwiki homepages at the moment.
             # In the long run better move accesskey customization to the userprefs menu instead
 ##                        if fail1 and fail2:
 ##                            content = ''
 ##                            break
-                    
+
                     content = content.replace(')', '')
                     content = content.replace(';', '')
 
                     # User hasn't specified a shortcut list
                     pass
 
-        if not content: 
+        if not content:
             # If there is no user shortcut list: Do we have some global shortcut lists
             # set in wikiconfig.py?
             lang_keydefaults = 'accesskey_defaults_%s' % self.request.lang
             # Otherwise check if 'accesskey_defaults' is set
             elif hasattr(self.request.cfg, 'accesskey_defaults'):
                 content = self.request.cfg.accesskey_defaults
-                
+
         script += u"""
 <script type="text/javascript">
 <!--
 """ % { 'shortcut_list': content,}
 
         return script
-    
+
     def html_stylesheets(self, d):
         """ Assemble html head stylesheet links
-        
+
         Just here so that in prior 1.6Moin version simplemente also renders correctly on IE
         """
         link = '<link rel="stylesheet" type="text/css" charset="%s" media="%s" href="%s">'
             prefix = self.cfg.url_prefix_static
         except:
             prefix = self.cfg.url_prefix
-            
+
         csshref = '%s/%s/css' % (prefix, self.name)
         for media, basename in stylesheets:
             href = '%s/%s.css' % (csshref, basename)
 <![endif]-->
 """ % prefix)
         except:
-            if self.cfg.hacks.get('ie7', False) and self.request.form.get('action', [''])[0] != 'edit':
+            if hasattr(self.cfg, 'hacks') and self.cfg.hacks.get('ie7', False) and self.request.form.get('action', [''])[0] != 'edit':
                 html.append("""
 <!-- compliance patch for microsoft browsers -->
 <!--[if lt IE 7]>
         Changed: If special editbar configs are found in wikiconfig.py, build customized
                  editbar according to the requested language. Otherwise use Moin's
                  default editbar.
-                
+
         @param d: parameter dictionary
         @rtype: unicode
         @return: iconbar html
 
         Raw action is by default opend now in a new window. Reason: There are no navigtional
         elements in the raw view which renders the page for an unexperienced user unusable.
-               
+
         @param d: parameter dictionary
         @param actions_dict: customized editbar items dictionary
         @rtype: unicode
 
 
     def editorLink(self, page):
-        """ Return a link to the editor 
-        
+        """ Return a link to the editor
+
         Changed: name attrib changed for accesskeys
                  name attrib for textedit remains unchanged, i.e. is always
                  set to 'texteditlink'
         """ Return subscribe/unsubscribe link to valid users
 
         Changed: name attrib added for accesskeys
-        
+
         @rtype: unicode
         @return: subscribe or unsubscribe link
         """
         """ Return add/remove quicklink link
 
         Changed: name attrib added for accesskeys
-        
+
         @rtype: unicode
         @return: link to add or remove a quicklink
         """
         if not self.request.user.valid:
             return ''
-   
+
         _ = self.request.getText
         # Try..except for backwards compatibility of Moin versions only
         try:
                 page = Page(request, text)
             pagename = page.page_name
             # Try..except for backwards compatibility of Moin versions only
-            try: 
+            try:
                 title = page.split_title()
             except:
                 title = page.split_title(request)
 
     def trail(self, d):
         """ Assemble page trail
-        
+
         Changed: name attrib added for accesskeys
         """
         request = self.request
 
         Changed: * we don't need a div wrapper for the textlogo
                  * append text "FrontPage" to the logo string
-        
+
         @rtype: unicode
         @return: logo html
         """
         if self.cfg.logo_string:
             page = wikiutil.getFrontPage(self.request)
             logo_string = self.cfg.logo_string
-            logo_append = '<span class="screenreader_info"> %s</span>' % _('FrontPage', formatted=False) 
+            logo_append = '<span class="screenreader_info"> %s</span>' % _('FrontPage', formatted=False)
             logo_string = logo_string + logo_append
             # Try..except for backwards compatibility of Moin versions only
             try:
         """ Assemble the msg display
 
         Changed: Added hidden h1 heading for better navigation with screenreaders
-        
+
         @param d: parameter dictionary
         @rtype: unicode
         @return: msg display html
 
         Changed: linebreak added for Simplemente. Searchbox formatting now done by
                  css
-        
+
         @param d: parameter dictionary
         @rtype: unicode
         @return: search form html
 <input id="searchinput" type="text" name="value" value="%(search_value)s" size="20"
     onfocus="searchFocus(this)" onblur="searchBlur(this)"
     onkeyup="searchChange(this)" onchange="searchChange(this)" alt="%(search_alt)s">
-<br> 
+<br>
 <input id="titlesearch" name="titlesearch" type="submit"
     value="%(search_title_label)s" alt="%(search_titles_alt)s">
 <input id="fullsearch" name="fullsearch" type="submit"
 
     def credits(self, d, **keywords):
         """ Create credits html from credits list
-        
+
         Changed: If no credits are set, the default Moin credits are disabled and replaced by
                  a Creative Common License hint for the wiki content.
         """
             pagename = wikiutil.getFrontPage(self.request).page_name
             pagename = wikiutil.quoteWikinameURL(pagename)
             cc_src = wikiutil.link_tag(self.request, pagename, self.request.cfg.sitename)
-         
+
         _credits = u'''<div id="creditos">
 <!--Creative Commons License-->
 %s is licensed under a
-<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0  License</a> 
+<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0  License</a>
 <br>
 <img alt="Creative Commons License" style="border-width: 0" src="%s"/>.
 <!--/Creative Commons License-->
         else:
             # Admin hasn't set new credits. Throw away the default credits and display simplemente credits only.
             page_credits = []
-        
+
         if isinstance(page_credits, (list, tuple)):
             if page_credits != []:
                 items = ['<li>%s</li>' % i for i in page_credits]
         If you put a <div id="accesskeys></div> somewhere in the page (e.g. by setting in wikiconfig.py
         "page_footer2 = u'<div id="accesskeys"></div>'"), the javascript function responsible for
         accesskeys augmentation of the page will add here a list of available shortcuts for the current
-        page. 
-        
+        page.
+
         However since we want to have also some translated text before this list, we have to do it here so as to be
         able to use the built-in getText.
 
         @rtype: unicode
         @return: image URI
         """
-        if self.cfg.url_prefix:
+        if hasattr(self.cfg, 'url_prefix'):
             uri = u'%s/simplemente/img/%s' % (self.cfg.url_prefix, image)
         else:
             uri = u'%s/simplemente/img/%s' % (self.cfg.url_prefix_static, image)
 
     ##
     ## Theme main-entry
-    ##    
+    ##
 
 def execute(request):
     """
     Generate and return a theme object
-        
+
     @param request: the request object
     @rtype: MoinTheme
     @return: Theme object