#23481 closed Bug (fixed)
Cannot view Trac tickets when logged in through GitHub
Reported by: | Kevin Brown | Owned by: | nobody |
---|---|---|---|
Component: | *.djangoproject.com | Version: | |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
How to Reproduce
- Remove the email from your Trac settings.
- Log out.
- Log in using the GitHub login.
- View any ticket.
- Trac gives an Internal Server Error.
If you set an email in your settings, this error disappears and tickets can be viewed. If you remove the email from your settings, and do not go through the login cycle again, this error will not appear. This error only occurs when you log into Trac and the email was not previously set.
Python Traceback
Traceback (most recent call last): File "/home/www/trac/venv/local/lib/python2.7/site-packages/trac/web/main.py", line 497, in _dispatch_request dispatcher.dispatch(req) File "/home/www/trac/venv/local/lib/python2.7/site-packages/trac/web/main.py", line 214, in dispatch resp = chosen_handler.process_request(req) File "/home/www/trac/venv/local/lib/python2.7/site-packages/trac/ticket/web_ui.py", line 179, in process_request return self._process_ticket_request(req) File "/home/www/trac/venv/local/lib/python2.7/site-packages/trac/ticket/web_ui.py", line 642, in _process_ticket_request get_reporter_id(req, 'author'), field_changes) File "/home/www/trac/venv/local/lib/python2.7/site-packages/trac/ticket/web_ui.py", line 1558, in _insert_ticket_data fields = self._prepare_fields(req, ticket, field_changes) File "/home/www/trac/venv/local/lib/python2.7/site-packages/trac/ticket/web_ui.py", line 1478, in _prepare_fields cc_action, cc_entry, cc_list = self._toggle_cc(req, cc) File "/home/www/trac/venv/local/lib/python2.7/site-packages/trac/ticket/web_ui.py", line 737, in _toggle_cc email = req.session.get('email', '').strip() AttributeError: 'NoneType' object has no attribute 'strip'
Change History (6)
comment:1 by , 10 years ago
comment:3 by , 10 years ago
Ah, OK, it return the empty string in my testing.
This patch in trac-github should fix it:
diff --git a/tracext/github.py b/tracext/github.py index 2033e48..d437ce0 100644 --- a/tracext/github.py +++ b/tracext/github.py @@ -69,8 +69,8 @@ class GitHubLoginModule(LoginModule): # Small hack to pass the username to _do_login. req.environ['REMOTE_USER'] = user['login'] # Save other available values in the session. - req.session.setdefault('name', user.get('name', '')) - req.session.setdefault('email', user.get('email', '')) + req.session.setdefault('name', user.get('name') or '') + req.session.setdefault('email', user.get('email') or '') return super(GitHubLoginModule, self)._do_login(req)
Version 0, edited 10 years ago by (next)
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
It appears to be working now, after the fix.
Note:
See TracTickets
for help on using tickets.
The trackback makes me think of https://github.com/aaugustin/trac-github/blob/master/tracext/github.py#L71 but I don't see how 'email' would end up being null there.