Modify

Opened 16 years ago

Closed 16 years ago

#3799 closed defect (fixed)

Bugs in code - wrong tuple declarations

Reported by: ergo@… 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)

Change History (1)

comment:1 in reply to:  description Changed 16 years ago by morodin

Resolution: fixed
Status: newclosed

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain morodin.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.