Description
On Debian unstable, MoinMoin doesn't work with Twisted. The server starts, but any attempt to look at the front page yields a stack trace, while attempts to look at /wiki are redirected to /wiki/moin.cgi and yield "no such resource".
Steps to reproduce
1. Install moin:
# apt-get install moin
This should install the packages moin, moinmoin-common, python-moinmoin and eg. python2.3-moin if you have Python2.3, or else python2.4-moin. I have Python2.3.
2. Somewhere in your home directory, create a Wiki instance, eg.:
$ mkdir moin $ cd moin $ cp -a /usr/share/moin/htdocs . $ cp -a /usr/share/moin/underlay . $ cp -a /usr/share/moin/data . $ cp -a /usr/share/moin/server/* .
Now you have a basic moin wiki setup. Adjust /etc/moin/farmconfig.py to list ("mointwisted", r"^localhost:8080/.*$") or similar in the wikis list (this is for compatibility with Debian's idea to have the config file named mointwisted.py). If you don't like that, rename accordingly. Adjust the variables in mointwisted.py to match the settings given in farmconfig.py, then run
$ ./mointwisted start
This will start the server which now listens on 8080. I have it on 9100 for my setup.
Details
MoinMoin Version |
1.3.4-2 (Debian version number |
OS and Version |
Debian unstable, i686 |
Python Version |
2.3.5 |
Server Setup |
Twisted, with 1.3.0 |
Server Details |
local server |
Workaround
Run in standalone mode instead of using Twisted.
Discussion
When trying to access the front page of the Wiki, running under Twisted, I get a stack trace. To read the error messages below, please note that spruce is the name of the machine, and the ip address is 192.168.1.10.
From twisted.log:
2005/04/10 15:58 CEST [-] MoinMoin.server.twistedmoin.MoinSite starting on 9100 2005/04/10 15:58 CEST [-] Starting factory <MoinMoin.server.twistedmoin.MoinSite instance at 0x408fa66c> 2005/04/10 15:58 CEST [-] set uid/gid 1001/1001 2005/04/10 15:58 CEST [HTTPChannel,0,192.168.1.10] /usr/lib/python2.3/site-packages/MoinMoin/request.py:1253: exceptions.DeprecationWarning: IPv4Address.__getitem__ is deprecated. Use attributes instead. 2005/04/10 15:58 CEST [HTTPChannel,0,192.168.1.10] /usr/lib/python2.3/site-packages/twisted/protocols/http.py:888: exceptions.DeprecationWarning: IPv4Address.__getitem__ is deprecated. Use attributes instead. 2005/04/10 15:58 CEST [HTTPChannel,0,192.168.1.10] /usr/lib/python2.3/site-packages/twisted/protocols/http.py:890: exceptions.DeprecationWarning: IPv4Address.__getitem__ is deprecated. Use attributes instead. 2005/04/10 15:58 CEST [HTTPChannel,0,192.168.1.10] [Sun Apr 10 15:58:24 2005] MoinMoin Configuration Error: 2005/04/10 15:58 CEST [HTTPChannel,0,192.168.1.10] Import of configuration file "mointwisted.py" failed because of TypeError: 2005/04/10 15:58 CEST [HTTPChannel,0,192.168.1.10] __init__() takes exactly 1 argument (2 given). 2005/04/10 15:58 CEST [HTTPChannel,0,192.168.1.10] 2005/04/10 15:58 CEST [HTTPChannel,0,192.168.1.10] We hope this error message make sense. If not, you are welcome to ask on 2005/04/10 15:58 CEST [HTTPChannel,0,192.168.1.10] the page http://moinmoin.wikiwikiweb.de/MoinMoinQuestions/ConfigFiles 2005/04/10 15:58 CEST [HTTPChannel,0,192.168.1.10] or the #moin channel on irc.freenode.net or on the mailing list. 2005/04/10 15:58 CEST [HTTPChannel,0,192.168.1.10] Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/twisted/protocols/http.py", line 965, in lineReceived self.allContentReceived() File "/usr/lib/python2.3/site-packages/twisted/protocols/http.py", line 1006, in allContentReceived req.requestReceived(command, path, version) File "/usr/lib/python2.3/site-packages/MoinMoin/server/twistedmoin.py", line 97, in requestReceived server.Request.requestReceived(self, command, path, version) File "/usr/lib/python2.3/site-packages/twisted/protocols/http.py", line 557, in requestReceived self.process() --- <exception caught here> --- File "/usr/lib/python2.3/site-packages/twisted/web/server.py", line 164, in process resrc = self.site.getResourceFor(self) File "/usr/lib/python2.3/site-packages/twisted/web/server.py", line 517, in getResourceFor return resource.getChildForRequest(self.resource, request) File "/usr/lib/python2.3/site-packages/twisted/web/resource.py", line 62, in getChildForRequest resource = resource.getChildWithDefault(pathElement, request) File "/usr/lib/python2.3/site-packages/twisted/web/resource.py", line 162, in getChildWithDefault return self.getChild(path, request) File "/usr/lib/python2.3/site-packages/twisted/web/vhost.py", line 117, in getChild return resrc.getChildWithDefault(path, request) File "/usr/lib/python2.3/site-packages/twisted/web/resource.py", line 162, in getChildWithDefault return self.getChild(path, request) File "/usr/lib/python2.3/site-packages/MoinMoin/server/twistedmoin.py", line 74, in getChild req = RequestTwisted(request, name, reactor) File "/usr/lib/python2.3/site-packages/MoinMoin/request.py", line 1294, in __init__ self.fail(err) File "/usr/lib/python2.3/site-packages/MoinMoin/request.py", line 948, in fail self.http_headers() File "/usr/lib/python2.3/site-packages/MoinMoin/request.py", line 1372, in http_headers for header in more_headers + self.user_headers: File "/usr/lib/python2.3/site-packages/MoinMoin/request.py", line 156, in __getattr__ raise AttributeError exceptions.AttributeError:
farmconfig.py (cruft omitted):
wikis = [ ("mointwisted", r"^spruce:9100/.*$") ]
Class FarmConfig only overwrites some attributes, but doesn't define any methods. mointwisted.py was also only changed to have some basic vars different (ie, other uid + gid, and port no).
- Interestingly, the wrong error handler tries to handle it. Why is it handled as a configuration error, Nir?
If you add raise error.FatalError() just after self._load_multi_cfg() in line 1283 in request.py, you can see the same error, caused by accessing attributes not declared yet. In all other requests, user_headers is initialized only in RequestBase.__init__, and _load_multi_cfg is called later. Its not clear why the twisted code has to set the auth_username in this stage, and not later.
1 # need config here, so check:
2 self._load_multi_cfg()
3 raise error.FatalError('Just testing')
4
5 if self.cfg.auth_http_enabled and self.cfg.auth_http_insecure:
6 self.auth_username = self.twistd.getUser()
7 # TODO password check, twisted does NOT do that for us
8 # this maybe requires bigger or critical changes, so we delay that
9 # to 1.4's new auth stuff
Reporter, please try the standard moin package, which is known to work on many platforms. This will help to trace where is the problem is in the debian package.
The error is cause by a bug in moin, the correct behavior in this case is to render the "MoinMoin configuration error" nice error message. The fact that there was a configuration error might be a bug in the deban pakacge.
Try to apply patch-683, and tell us what happen.
Plan
- Priority:
- Assigned to:
- Status: fixed patch-683