Modify ↓
Opened 17 years ago
Closed 17 years ago
#3799 closed defect (fixed)
Bugs in code - wrong tuple declarations
| Reported by: | Owned by: | morodin | |
|---|---|---|---|
| Priority: | normal | Component: | NoticeManagerPlugin |
| Severity: | blocker | Keywords: | |
| Cc: | Trac Release: | 0.11 |
Description
The code is buggy - several wrong tuple declarations like:
cursor.execute("DELETE FROM session WHERE sid=%s", (account))
instead of
cursor.execute("DELETE FROM session WHERE sid=%s", (account,))
This is the fix for all found occurences, I found - after this, plugin works for me:
--- /usr/local/src/noticemanagerplugin/0.11/notice_mgr/admin.py 2008-09-25 06:53:28.000000000 +0000
+++ /tmp/admin-HEAD.py 2008-09-25 07:41:39.000000000 +0000
@@ -295,13 +295,13 @@
cursor = db.cursor()
cursor.execute("SELECT count(*) FROM session "
"WHERE sid=%s AND authenticated=1",
- (username,))
+ (username))
exists, = cursor.fetchone()
if not exists:
cursor.execute("INSERT INTO session "
"(sid, authenticated, last_visit) "
"VALUES (%s, 1, 0)",
- (username,))
+ (username))
for key in ('name', 'email_verification_sent_to', 'email'):
value = arr.get(key)
@@ -326,8 +326,8 @@
for account in sel:
if (not account) or (account == None):
continue
- cursor.execute("DELETE FROM session_attribute WHERE sid=%s", (account,))
- cursor.execute("DELETE FROM session WHERE sid=%s", (account,))
+ cursor.execute("DELETE FROM session_attribute WHERE sid=%s", (account))
+ cursor.execute("DELETE FROM session WHERE sid=%s", (account))
if (account[0] == GROUP_PREFIX):
del groupinfos[account]
else:
@@ -343,7 +343,7 @@
for account in sel:
if (not account) or (account == None):
continue
- cursor.execute("DELETE FROM session_attribute WHERE sid=%s", (account,))
+ cursor.execute("DELETE FROM session_attribute WHERE sid=%s", (account))
if (account[0] == GROUP_PREFIX):
groupinfos[account] = { 'id' : account, 'name' : "", 'email' : ""}
else:
@@ -362,8 +362,8 @@
sel.append(account)
for account in sel:
- cursor.execute("DELETE FROM session_attribute WHERE sid=%s", (account,))
- cursor.execute("DELETE FROM session WHERE sid=%s", (account,))
+ cursor.execute("DELETE FROM session_attribute WHERE sid=%s", (account))
+ cursor.execute("DELETE FROM session WHERE sid=%s", (account))
if (account[0] == GROUP_PREFIX):
del groupinfos[account]
else:
Attachments (0)
Note: See
TracTickets for help on using
tickets.



Replying to ergo@ergo-pc.net: Strange, I tried the code and for me, it seemed to work. Nethertheless, I incooperated your changes. Thanks for your effort.