2DU 8 yıl önce
ebeveyn
işleme
ab10620835
2 değiştirilmiş dosya ile 12 ekleme ve 21 silme
  1. 6 9
      app.py
  2. 6 12
      func.py

+ 6 - 9
app.py

@@ -2181,13 +2181,13 @@ def topic_block(name = None, sub = None, num = None):
             curs.execute("update topic set block = '' where title = ? and sub = ? and id = ?", [name, sub, str(num)])
         else:
             curs.execute("update topic set block = 'O' where title = ? and sub = ? and id = ?", [name, sub, str(num)])
-        conn.commit()
         
         rd_plus(
             name, 
             sub, 
             get_time()
         )
+        conn.commit()
         
     return(redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '#' + str(num)))
         
@@ -2206,14 +2206,13 @@ def topic_top(name = None, sub = None, num = None):
                 curs.execute("update topic set top = '' where title = ? and sub = ? and id = ?", [name, sub, str(num)])
             else:
                 curs.execute("update topic set top = 'O' where title = ? and sub = ? and id = ?", [name, sub, str(num)])
-
-        conn.commit()
         
         rd_plus(
             name, 
             sub, 
             get_time()
         )
+        conn.commit()
 
     return(redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub) + '#' + str(num)))        
 
@@ -2237,13 +2236,13 @@ def topic_agree(name = None, sub = None):
         else:
             curs.execute("insert into topic (id, title, sub, data, date, ip, block, top) values (?, ?, ?, '합의 완료', ?, ?, '', '1')", [str(int(topic_check[0][0]) + 1), name, sub, time, ip])
             curs.execute("insert into agreedis (title, sub) values (?, ?)", [name, sub])
-        conn.commit()
-        
+
         rd_plus(
             name, 
             sub, 
             time
         )
+        conn.commit()
             
     return(redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub)))
         
@@ -2281,14 +2280,13 @@ def topic_stop(name = None, sub = None, tool = None):
             curs.execute("insert into topic (id, title, sub, data, date, ip, block, top) values (?, ?, ?, ?, ?, ?, '', '1')", [str(int(topic_check[0][0]) + 1), name, sub, data, time, ip])
             curs.execute("insert into stop (title, sub, close) values (?, ?, ?)", [name, sub, close])
             curs.execute("delete from stop where title = ? and sub = ? and close = ?", [name, sub, n_close])
-            
-        conn.commit()
         
         rd_plus(
             name, 
             sub, 
             time
         )
+        conn.commit()
         
     return(redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(sub)))    
 
@@ -3454,8 +3452,6 @@ def upload():
             curs.execute("delete from data where title = ?", ['파일:' + name])
         
         curs.execute("insert into data (title, data, acl) values (?, ?, 'admin')", ['파일:' + name, '[[파일:' + name + ']][br][br]{{{[[파일:' + name + ']]}}}[br][br]' + lice])
-        conn.commit()
-        
         history_plus(
             '파일:' + name, 
             '[[파일:' + name + ']][br][br]{{{[[파일:' + name + ']]}}}[br][br]' + lice, 
@@ -3464,6 +3460,7 @@ def upload():
             '(파일 올림)', 
             '0'
         )
+        conn.commit()
         
         return(redirect('/w/파일:' + name))            
     else:

+ 6 - 12
func.py

@@ -43,8 +43,7 @@ def include(title, old, new):
         m2 = re.findall("\[\[(분류:(?:(?:(?!\]\]).)*))\]\]", new_d)
 
         curs.execute("select link from back where title = ? and type = 'include'", [title])
-        d1 = curs.fetchall()
-        for x in d1:
+        for x in curs.fetchall():
             for y in m1:
                 curs.execute("delete from back where link = ? and type = 'cat'", [y])
 
@@ -168,8 +167,7 @@ def ip_pas(raw_ip):
         ip = raw_ip
     else:
         curs.execute("select title from data where title = ?", ['사용자:' + raw_ip])
-        data = curs.fetchall()
-        if(data):
+        if(curs.fetchall()):
             ip = '<a href="/w/' + url_pas('사용자:' + raw_ip) + '">' + raw_ip + '</a>'
         else:
             ip = '<a class="not_thing" href="/w/' + url_pas('사용자:' + raw_ip) + '">' + raw_ip + '</a>'
@@ -323,25 +321,21 @@ def topic_check(name, sub):
 
 def rd_plus(title, sub, date):
     curs.execute("select title from rd where title = ? and sub = ?", [title, sub])
-    rd = curs.fetchall()
-    if(rd):
+    if(curs.fetchall()):
         curs.execute("update rd set date = ? where title = ? and sub = ?", [date, title, sub])
     else:
         curs.execute("insert into rd (title, sub, date) values (?, ?, ?)", [title, sub, date])
-    conn.commit()
     
 def rb_plus(block, end, today, blocker, why):
     curs.execute("insert into rb (block, end, today, blocker, why) values (?, ?, ?, ?, ?)", [block, end, today, blocker, why])
-    conn.commit()
 
 def history_plus(title, data, date, ip, send, leng):
     curs.execute("select id from history where title = ? order by id+0 desc limit 1", [title])
-    rows = curs.fetchall()
-    if(rows):
-        curs.execute("insert into history (id, title, data, date, ip, send, leng) values (?, ?, ?, ?, ?, ?, ?)", [str(int(rows[0][0]) + 1), title, data, date, ip, send, leng])
+    d = curs.fetchall()
+    if(d):
+        curs.execute("insert into history (id, title, data, date, ip, send, leng) values (?, ?, ?, ?, ?, ?, ?)", [str(int(d[0][0]) + 1), title, data, date, ip, send, leng])
     else:
         curs.execute("insert into history (id, title, data, date, ip, send, leng) values ('1', ?, ?, ?, ?, ?, ?)", [title, data, date, ip, send + ' (새 문서)', leng])
-    conn.commit()
 
 def leng_check(a, b):
     if(a < b):