浏览代码

깔끔하게

ect (or 2du) 8 年之前
父节点
当前提交
e4d0923fbb
共有 3 个文件被更改,包括 169 次插入176 次删除
  1. 156 160
      app.py
  2. 7 9
      func.py
  3. 6 7
      set_mark/tool.py

文件差异内容过多而无法显示
+ 156 - 160
app.py


+ 7 - 9
func.py

@@ -1,8 +1,6 @@
 # 모듈들 불러옴
-from css_html_js_minify import html_minify, js_minify, css_minify
-from flask import session, render_template
-from urllib import parse
-
+import css_html_js_minify
+import flask
 import json
 import sqlite3
 import hashlib
@@ -295,12 +293,12 @@ def ip_pas(raw_ip):
     return ip
 
 def custom():
-    if 'MyMaiToNight' in session:
-        user_head = session['MyMaiToNight']
+    if 'MyMaiToNight' in flask.session:
+        user_head = flask.session['MyMaiToNight']
     else:
         user_head = ''
 
-    if 'Now' in session and session['Now'] == 1:
+    if 'Now' in flask.session and flask.session['Now'] == 1:
         curs.execute('select name from alarm where name = ? limit 1', [ip_check()])
         if curs.fetchall():
             user_icon = 2
@@ -533,7 +531,7 @@ def re_error(data):
                 if end_data[0][1] != '':
                     end += '<li>Why : ' + end_data[0][1] + '</li>'
 
-        return html_minify(render_template(skin_check(), 
+        return css_html_js_minify.html_minify(flask.render_template(skin_check(), 
             imp = ['Authority Error', wiki_set(1), custom(), other2([0, 0])],
             data = '<h2>Info</h2><ul>' + end + '</ul>',
             menu = 0
@@ -610,7 +608,7 @@ def re_error(data):
             data = '???'
 
         if title:
-            return html_minify(render_template(skin_check(), 
+            return css_html_js_minify.html_minify(flask.render_template(skin_check(), 
                 imp = [title, wiki_set(1), custom(), other2([0, 0])],
                 data = '<h2>Error</h2><ul><li>' + data + '</li></ul>',
                 menu = 0

+ 6 - 7
set_mark/tool.py

@@ -1,6 +1,5 @@
-from flask import session, request
-
-from urllib import parse
+import flask
+import urllib.parse
 import datetime
 import re
 import hashlib
@@ -9,11 +8,11 @@ def get_time():
     return str(datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S"))
     
 def ip_check():
-    if session and ('Now' and 'DREAMER') in session and session['Now'] == 1:
-        ip = session['DREAMER']
+    if flask.session and ('Now' and 'DREAMER') in flask.session and flask.session['Now'] == 1:
+        ip = flask.session['DREAMER']
     else:
         try:
-            ip = request.environ.get('HTTP_X_REAL_IP', request.remote_addr)
+            ip = flask.request.environ.get('HTTP_X_REAL_IP', flask.request.remote_addr)
         except:
             ip = 'None'
 
@@ -32,7 +31,7 @@ def savemark(data):
     return data
 
 def url_pas(data):
-    return parse.quote(data).replace('/','%2F')
+    return urllib.parse.quote(data).replace('/','%2F')
 
 def sha224(data):
     return hashlib.sha224(bytes(data, 'utf-8')).hexdigest()

部分文件因为文件数量过多而无法显示