Modify ↓
Opened 16 years ago
Closed 8 years ago
#3513 closed defect (wontfix)
[PATCH] login, logout redirect breaks with an AttributeError
Reported by: | Jeff Hammel | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | TracForgePlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
Following successful login, I get the following error on redirect:
Trac detected an internal error: AttributeError: startswith <snip/> 272. status = 303 # 'See Other' -- safe to use in response to a POST 273. else: 274. status = 302 # 'Found' -- normal temporary redirect 275. 276. self.send_response(status) 277. if not url.startswith('http://') and not url.startswith('https://'): 278. # Make sure the URL is absolute 279. scheme, host = urlparse.urlparse(self.base_url)[:2] 280. url = urlparse.urlunparse((scheme, host, url, None, None, None)) 281. 282. self.send_header('Location', url) Local variables: Name Value permanent u'http://127.0.0.1:14828/master/' self <Request "POST u'/login'"> status 301 url <Request "POST u'/login'"> * File "/home/jhammel/tracforge/src/trac/trac/web/api.py", line 172, in __getattr__ Code fragment: 167. callbacks dictionary.""" 168. if name in self.callbacks: 169. value = self.callbacks[name](self) 170. setattr(self, name, value) 171. return value 172. raise AttributeError(name) 173. 174. def __repr__(self): 175. return '<%s "%s %r">' % (self.__class__.__name__, self.method, 176. self.path_info) 177. Local variables: Name Value name 'startswith' self <Request "POST u'/login'"> File "/home/jhammel/tracforge/src/trac/trac/web/main.py", line 447, in _dispatch_request dispatcher.dispatch(req) File "/home/jhammel/tracforge/src/trac/trac/web/main.py", line 206, in dispatch resp = chosen_handler.process_request(req) File "/home/jhammel/tracforge/src/accountmanagerplugin/acct_mgr/web_ui.py", line 433, in process_request return auth.LoginModule.process_request(self, req) File "/home/jhammel/tracforge/src/trac/trac/web/auth.py", line 107, in process_request self._redirect_back(req) File "/home/jhammel/tracforge/src/accountmanagerplugin/acct_mgr/web_ui.py", line 455, in _redirect_back req.redirect(referer or self.env.abs_href()) File "/home/jhammel/tracforge/src/tracforgeplugin/tracforge/linker/auth.py", line 76, in my_redirect old_redirect(req, *args, **kwords) File "/home/jhammel/tracforge/src/trac/trac/web/api.py", line 277, in redirect if not url.startswith('http://') and not url.startswith('https://'): File "/home/jhammel/tracforge/src/trac/trac/web/api.py", line 172, in __getattr__ raise AttributeError(name)
My setup is:
- trac trunk, r7338
- accountmanager trunk, r4116 (using htdigest and form authentication)
- tracforge 0.11, r4116
This seems to be because the request is being passed in to a method bound to the request (old_redirect is a bound method). This can be fixed with the following patch:
Index: linker/auth.py =================================================================== --- linker/auth.py (revision 4116) +++ linker/auth.py (working copy) @@ -73,7 +73,7 @@ if parts[2].startswith(self.uri_root) and (not parts[1] or parts[1] == req.server_name): Request.redirect(req, referer) - old_redirect(req, *args, **kwords) + old_redirect(*args, **kwords) req.redirect = my_redirect
Attachments (0)
Change History (2)
comment:1 Changed 10 years ago by
Owner: | Noah Kantrowitz deleted |
---|
comment:2 Changed 8 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
Plugin is deprecated.