Opened 16 years ago
Last modified 15 years ago
#5232 new defect
MyPagePlugin not functioning as default handler (solution included, but raises another error)
| Reported by: | anonymous | Owned by: | dgc |
|---|---|---|---|
| Priority: | high | Component: | TracMyPagePlugin |
| Severity: | major | Keywords: | Trac default_handler |
| Cc: | Trac Release: | 0.11 |
Description
When setting the MyPagePlugin as default handler in Trac
trac.ini
[trac] default_handler = MyPagePlugin
... the page begins to load and nothing happens. I only get following error in the console (using trac as daemon without apache or sth. similar):
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 2924)
Traceback (most recent call last):
File "C:\Python25\lib\SocketServer.py", line 464, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python25\lib\SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python25\lib\SocketServer.py", line 522, in __init__
self.handle()
File "C:\Python25\lib\BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "C:\Python25\lib\site-packages\trac-0.11.4rc1-py2.5-win32.egg\trac\web\wsgi.py", line 175, in handle_one_request
gateway.run(self.server.application)
File "C:\Python25\lib\site-packages\trac-0.11.4rc1-py2.5-win32.egg\trac\web\wsgi.py", line 98, in run
self._write('')
File "C:\Python25\lib\site-packages\trac-0.11.4rc1-py2.5-win32.egg\trac\web\wsgi.py", line 192, in _write
assert self.headers_set, 'Response not started'
AssertionError: Response not started
----------------------------------------
I didn't have any clue about python before today, but I could fix this problem by determining the default handler within the function/method process_request(self, req) of the MyPagePlugin.py file like following (+ means added; # means changed):
36 def process_request(self, req):
37 url = self.mypage_url(req)
++ if self.config.get('trac', 'default_handler') == 'MyPagePlugin':
++ replacement_urls = ['/me', '/']
++ else:
++ replacement_urls = ['/']
38 self.log.debug('process_request: %s' % url)
## if req.path_info in replacement_urls:
40 req.send_response(307)
41 req.send_header('Location', url)
42 req.end_headers()
43 return
But now I have another problem...
Our Trac is configured to redirect the user to the login page if the permission is insufficient. In words: all anonymous access is forbidden, only authenticated users can do anything. PermRedirectPlugin is used for this.
Because of the fix I made the following page is coming up when there is no authentication cookie and the site is called:
Oops…
Trac detected an internal error:
TypeError: issubclass() arg 1 must be a classThere was an internal error in Trac. It is recommended that you inform your local >Trac administrator and give him all the information he needs to reproduce the issue.
The action that triggered the error was:
GET: /
Because I'm bloody new to Python, at this point I am at my wits' end.
The tracd server daemon is running on Windows XP Professional SP2 if that helps.
Attachments (0)
Change History (1)
comment:1 Changed 15 years ago by
| Keywords: | Trac added; tracd TracMyPagePlugin removed |
|---|



Replying to anonymous:
Why would you/someone do that? Plugins is simply not intended as a default handler for Trac. Simply don't expect it to do so, but use as documented. You may still need to apply a patch before #4887 is resolved, to get expected results.
I suggest to close this ticket as invalid/wontfix/worksforme.