#12349 closed defect (fixed)
AttributeError: 'list' object has no attribute 'lower'
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.11 |
Component: | version control/browser | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Replaced uses of |
||
API Changes: | |||
Internal Changes: |
Description
Found in the logs:
[pid 25608 140573411886848] 2016-02-04 18:19:12,083 Trac[main] ERROR: Internal Server Error: <RequestWithSession "GET '/browser/trunk/trac/ticket/model.py?rev=6512&rev=6512'">, referrer None Traceback (most recent call last): File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/web/main.py", line 607, in _dispatch_request dispatcher.dispatch(req) File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/web/main.py", line 256, in dispatch resp = chosen_handler.process_request(req) File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/versioncontrol/web_ui/browser.py", line 335, in process_request if rev.lower() in ('', 'head'): AttributeError: 'list' object has no attribute 'lower'
I recall Jun reporting a similar issue with duplicated arguments. I'll need to search for that.
Attachments (0)
Change History (8)
comment:1 by , 9 years ago
follow-up: 4 comment:2 by , 9 years ago
The traceback could be avoided with the following change:
-
trac/versioncontrol/web_ui/browser.py
diff --git a/trac/versioncontrol/web_ui/browser.py b/trac/versioncontrol/web_ui/browser.py index f6a888f..72deddd 100644
a b class BrowserModule(Component): 332 332 req.redirect(presel) 333 333 334 334 path = req.args.get('path', '/') 335 rev = req.args.get ('rev', '')335 rev = req.args.getfirst('rev', '') 336 336 if rev.lower() in ('', 'head'): 337 337 rev = None 338 338 format = req.args.get('format')
Another possibility would be to add an as_str
method, following the pattern suggested in comment:5:ticket:12325.
However, it's worth considering to just close this as wontfix. I rarely see the issue in the logs, and my main goal is to fix issues that are frequent in the logs. I'd like to reduce the noisiness of the logs so I can review them faster each day for the dozen or so sites that I monitor, so that real issues can be spotted and fixed proactively. Even now there is so much noise in the logs that it takes 10-20 minutes to review them each day, despite pre-processing that aggregates the logs and filters out HTTPNotFound, HTTPBadRequest, etc …
comment:3 by , 9 years ago
Milestone: | 1.0.10 |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
comment:4 by , 9 years ago
Replying to Ryan J Ollos:
However, it's worth considering to just close this as wontfix. I rarely see the issue in the logs, and my main goal is to fix issues that are frequent in the logs. I'd like to reduce the noisiness of the logs so I can review them faster each day for the dozen or so sites that I monitor, so that real issues can be spotted and fixed proactively. Even now there is so much noise in the logs that it takes 10-20 minutes to review them each day, despite pre-processing that aggregates the logs and filters out HTTPNotFound, HTTPBadRequest, etc …
The noise in the logs in significantly reduced now that all monitored sites are running Trac 1.0.10 or very recent Trac 1.2dev.
comment:5 by , 9 years ago
Another similar case:
[pid 28869 139845353346816] 2016-04-03 20:02:58,023 Trac[main] ERROR: Internal Server Error: <RequestWithSession "GET '/timeline?from=2016-02-19T11%3A12%3A59%2B01%3A00&precision=second&from=Feb+19%2C+2016&daysback=7&authors=&changeset=on&repo-=on&repo-cboos.git=on&repo-cboos.hg=on&repo-jomae.git=on&repo-jomae.hg=on&repo-mercurial-plugin=on&repo-mirror=on&repo-psuter.git=on&repo-psuter.hg=on&repo-rblank=on&repo-rjollos.git=on&repo-ticket-links=on&milestone=on&ticket=on&wiki=on&sfp_email=&sfph_mail=&update=Update'">, referrer None Traceback (most recent call last): File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/web/main.py", line 607, in _dispatch_request dispatcher.dispatch(req) File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/web/main.py", line 256, in dispatch resp = chosen_handler.process_request(req) File "/usr/local/virtualenv/1.1dev/lib/python2.7/site-packages/trac/timeline/web_ui.py", line 114, in process_request reqfromdate = req.args['from'].strip() AttributeError: 'list' object has no attribute 'strip'
comment:6 by , 9 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
comment:7 by , 9 years ago
Milestone: | → 1.0.11 |
---|---|
Owner: | set to |
Release Notes: | modified (diff) |
Status: | reopened → assigned |
I'm going to fix a few instances, such as comment:5.
-
trac/timeline/web_ui.py
diff --git a/trac/timeline/web_ui.py b/trac/timeline/web_ui.py index 050f142..15f8c79 100644
a b class TimelineModule(Component): 90 90 def process_request(self, req): 91 91 req.perm.assert_permission('TIMELINE_VIEW') 92 92 93 format = req.args.get('format') 94 maxrows = as_int(req.args.get('max'), 50 if format == 'rss' else 0) 93 format = req.args.getfirst('format') 94 default_maxrows = 50 if format == 'rss' else 0 95 maxrows = as_int(req.args.getfirst('max'), default_maxrows) 95 96 lastvisit = int(req.session.get('timeline.lastvisit', '0')) 96 97 97 98 # indication of new events is unchanged when form is updated by user … … class TimelineModule(Component): 109 110 precisedate = precision = None 110 111 if 'from' in req.args: 111 112 # Acquire from date only from non-blank input 112 reqfromdate = req.args ['from'].strip()113 reqfromdate = req.args.getfirst('from').strip() 113 114 if reqfromdate: 114 115 try: 115 116 precisedate = user_time(req, parse_date, reqfromdate) … … class TimelineModule(Component): 117 118 add_warning(req, e) 118 119 else: 119 120 fromdate = precisedate.astimezone(req.tz) 120 precision = req.args.get ('precision', '')121 precision = req.args.getfirst('precision', '') 121 122 if precision.startswith('second'): 122 123 precision = timedelta(seconds=1) 123 124 elif precision.startswith('minute'): … … class TimelineModule(Component): 130 131 fromdate.day, 23, 59, 59, 999999), 131 132 req.tz) 132 133 133 daysback = as_int(req.args.get ('daysback'),134 daysback = as_int(req.args.getfirst('daysback'), 134 135 90 if format == 'rss' else None) 135 136 if daysback is None: 136 137 daysback = as_int(req.session.get('timeline.daysback'), None) … … class TimelineModule(Component): 140 141 if self.max_daysback >= 0: 141 142 daysback = min(self.max_daysback, daysback) 142 143 143 authors = req.args.get ('authors')144 authors = req.args.getfirst('authors') 144 145 if authors is None and format != 'rss': 145 146 authors = req.session.get('timeline.authors') 146 147 authors = (authors or '').strip()
comment:8 by , 9 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Replying to Ryan J Ollos:
I was thinking of the issues discussed in comment:4:ticket:10907 and the comments that follow.