#3193 closed defect (fixed)
if anonymous session doesn't exist, promotion fails
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | normal | Milestone: | 0.10 |
Component: | general | Version: | devel |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
If we can't get any session, promote_session (source:trunk/trac/web/session.py@3342#L119) throws the following exception:
2006-05-25 10:42:27,676 Trac[main] ERROR: iteration over non-sequence Traceback (most recent call last): File "/usr/local/lib/python2.4/site-packages/trac/web/main.py", line 299, in dispatch_request dispatcher.dispatch(req) File "/usr/local/lib/python2.4/site-packages/trac/web/main.py", line 176, in dispatch req.session = Session(self.env, req) File "/usr/local/lib/python2.4/site-packages/trac/web/session.py", line 51, in __init__ self.promote_session(sid) File "/usr/local/lib/python2.4/site-packages/trac/web/session.py", line 118, in promote_session authenticated_flags = [row[0] for row in cursor.fetchall()]
Changing:
authenticated_flags = [row[0] for row in cursor.fetchall()]
to:
try: authenticated_flags = [row[0] for row in cursor.fetchall()] except TypeError: authenticated_flags = []
works for me.
Attachments (0)
Change History (8)
comment:1 by , 18 years ago
comment:2 by , 18 years ago
Hm. It seems I am using pysqlite1.1 (sqlite3). This was perhaps an artifact of a transition from trac on suse to trac on ubuntu.
comment:3 by , 18 years ago
i always thought i use pysqlit 2.something. i get the error too after upgrading to trunk. how do i check which pysqlite version i'm using? i set the log to debug, but it does not tell me the db version, pysqlite version and so on …
comment:4 by , 18 years ago
i forgot, it happens only with a fresh created instance. with the upgraded ones i still can log in.
comment:5 by , 18 years ago
Milestone: | → 0.10 |
---|
comment:6 by , 18 years ago
Milestone: | 0.10 |
---|
Do not assign a milestone if you don't provide a patch and/or without an agreement with one of the developers.
comment:7 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This was probably caused the custom connection wrapper we use with pysqlite1. This should be fixed in r3347.
comment:8 by , 18 years ago
Milestone: | → 0.10 |
---|
It looks like
cursor.fetchall()
returns None or something when no rows are returned. Which database and database driver are you using?At least pysqlite2 and psycopg2 seems to return an empty list ([]).