Description

Just now upgraded to moin-1.3.3 and i am still getting the same error. I am using the following line in wikiconfig.py. Adding this line makes moin come up with the exception.

    url_mappings  = {"/cgi-bin/moin.cgi/":"/"}

Plain text traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/MoinMoin/request.py", line 831, in run
    self.page.send_page(self, count_hit=1)
  File "/usr/lib/python2.3/site-packages/MoinMoin/Page.py", line 1125, in send_page
    allow_doubleclick=1, trail=trail,
  File "/usr/lib/python2.3/site-packages/MoinMoin/wikiutil.py", line 1199, in send_title
    output.append(theme.header(d))
  File "/usr/lib/python2.3/site-packages/MoinMoin/theme/modern.py", line 25, in header
    html = [
  File "/usr/lib/python2.3/site-packages/MoinMoin/theme/__init__.py", line 301, in navibar
    pagename, link = self.splitNavilink(text)
  File "/usr/lib/python2.3/site-packages/MoinMoin/theme/__init__.py", line 257, in splitNavilink
    link = page.link_to(request, title)
  File "/usr/lib/python2.3/site-packages/MoinMoin/Page.py", line 831, in link_to
    formatter=getattr(self, 'formatter', None), **kw)
  File "/usr/lib/python2.3/site-packages/MoinMoin/wikiutil.py", line 863, in link_tag
    css_class, **kw) +
  File "/usr/lib/python2.3/site-packages/MoinMoin/formatter/text_html.py", line 264, in url
    url = wikiutil.mapURL(self.request, url)
  File "/usr/lib/python2.3/site-packages/MoinMoin/wikiutil.py", line 794, in mapURL
    if url.startswith(prefix):
AttributeError: 'NoneType' object has no attribute 'startswith'

The cgitb output is more revealing. I am including here the part I couldnt understand:

[...]

 /usr/lib/python2.3/site-packages/MoinMoin/Page.py in link_to(self=<MoinMoin.Page.Page instance>, request=<MoinMoin.request.RequestCGI instance>, text=u'FrontPage', querystr=None, anchor=None, **kw={})
  829 
  830         link = wikiutil.link_tag(request, url, wikiutil.escape(text),
  831                                  formatter=getattr(self, 'formatter', None), **kw)
  832 
  833         # Create a link to attachments if any exist
formatter undefined, getattr undefined, self = <MoinMoin.Page.Page instance>, None undefined, kw = {}

 /usr/lib/python2.3/site-packages/MoinMoin/wikiutil.py in link_tag(request=<MoinMoin.request.RequestCGI instance>, params='FrontPage', text=u'FrontPage', formatter=<MoinMoin.formatter.text_html.Formatter instance>, on=None, **kw={})
  861                                  css_class, **kw)
  862         return (formatter.url(1, "%s/%s" % (request.getScriptname(), params),
  863                               css_class, **kw) +
  864                 formatter.rawHTML(text) +
  865                 formatter.url(0))
css_class = None, kw = {}

 /usr/lib/python2.3/site-packages/MoinMoin/formatter/text_html.py in url(self=<MoinMoin.formatter.text_html.Formatter instance>, on=0, url=None, css=None, **kw={})
  262                 ... some more (!!! TODO) 
  263         """
  264         url = wikiutil.mapURL(self.request, url)
  265         pretty = kw.get('pretty_url', 0)
  266         title = kw.get('title', None)
url = None, global wikiutil = <module 'MoinMoin.wikiutil' from '/usr/lib/python2.3/site-packages/MoinMoin/wikiutil.py'>, wikiutil.mapURL = <function mapURL>, self = <MoinMoin.formatter.text_html.Formatter instance>, self.request = <MoinMoin.request.RequestCGI instance>

[...]

Somehow line 862 of wikiutil.py is sending a valid URL to formatter.url, but the latter is not receiving any URL in its parameters.

Steps to reproduce

  1. I am getting this on the site http://www.lug-delhi.org (you can take a look there to see if some combination of links out there is causing the problem).

  2. I am getting this problem as soon as I add the following line in wikiconfig.py.

        url_mappings  = {"/cgi-bin/moin.cgi/":"/"}

Details

MoinMoin Version

MoinMoin Release 1.3.3 [Revision patch-434]

OS and Version

Red Hat Linux 7.3 2.4.20-37.7.legacy

Python Version

Python 2.3.3

Server Setup

Celeron 1.7Ghz/1GB Ram

Workaround

None known

Discussion

I am experiencing exactly the same bug with MoinMoin 1.3.3 and Python 2.2.2 on Linux.

I would like to use shorter urls, i.e. http://sitename/FrontPage instead of http://sitename/cgi-bin/moin.cgi/FrontPage, so I've added the necessary RewriteRule clauses to my .htaccess and now I would like MoinMoin to generate similar urls via url_mappings (is there a better way?), but url_mappings is causing this error.

-- CharlBotha


I don't think you need this at all. You can define short urls by ScriptAlias or rewrite rules, as described in the installation docs. -- NirSoffer 2005-02-03 17:47:50


The patch fixes the traceback all right. I dont thing ScriptAlias or rewrite rules solves the complete problem. Incoming links can be routed to Moin using this all right. But the links that moin generates should also follow the url mapping that these rewrite rules provide.

Even now, URL mapping feature works partially. It doesnt work for URLs like the links, or the URLs in the titlepage. I dont want my users to bookmark pages with /cgi-bin/moin.cgi in them. I want them to use simple urls like http:/ /domain/PageName. But if moin doesnt cooperate sooner or later they will bookmark the ugly URLs instead.

-- SandipBhattacharya 2024-04-25 01:36:40

This has nothing to do with that specific fixed bug, so there is no point to discuss this here. As I said, you don't need url_mapping to get rid of cgi-bin/moin.cgi in urls. Please use the proper page, MoinMoinQuestions, or any Support* page to discuss your configuration difficulties. -- NirSoffer 2005-02-10 10:48:11

Plan


CategoryMoinMoinBugFixed CategoryRelease1.3.4

MoinMoin: MoinMoinBugs/URLMappingsCausesTraceback (last edited 2007-10-29 19:20:20 by localhost)