ソースを参照

주시 문서 Golang으로 이전 예정

잉여개발기 10 ヶ月 前
コミット
e7153d0ab2

+ 4 - 4
app.py

@@ -644,8 +644,8 @@ app.route('/xref_page/<int:num>/<everything:name>')(view_xref)
 app.route('/xref_this/<everything:name>', defaults = { 'xref_type' : 2 })(view_xref)
 app.route('/xref_this_page/<int:num>/<everything:name>', defaults = { 'xref_type' : 2 })(view_xref)
 
-app.route('/doc_watch_list/<int:num>/<everything:name>')(w_watch_list)
-app.route('/doc_star_doc/<int:num>/<everything:name>', defaults = { 'do_type' : 'star_doc' })(w_watch_list)
+app.route('/doc_watch_list/<int:num>/<everything:name>')(view_w_watch_list)
+app.route('/doc_star_doc/<int:num>/<everything:name>', defaults = { 'do_type' : 'star_doc' })(view_w_watch_list)
 
 app.route('/raw/<everything:name>')(view_w_raw)
 app.route('/raw_acl/<everything:name>', defaults = { 'doc_acl' : 'on' })(view_w_raw)
@@ -738,11 +738,11 @@ app.route('/alarm')(user_alarm)
 app.route('/alarm/delete')(user_alarm_delete)
 app.route('/alarm/delete/<int:id>')(user_alarm_delete)
 
-app.route('/watch_list', defaults = { 'tool' : 'watch_list' })(user_watch_list)
+app.route('/watch_list', defaults = { 'do_type' : 'watch_list' })(view_user_watch_list)
 app.route('/watch_list/<everything:name>', defaults = { 'tool' : 'watch_list' })(user_watch_list_name)
 app.route('/watch_list_from/<everything:name>', defaults = { 'tool' : 'watch_list_from' })(user_watch_list_name)
 
-app.route('/star_doc', defaults = { 'tool' : 'star_doc' })(user_watch_list)
+app.route('/star_doc', defaults = { 'do_type' : 'star_doc' })(view_user_watch_list)
 app.route('/star_doc/<everything:name>', defaults = { 'tool' : 'star_doc' })(user_watch_list_name)
 app.route('/star_doc_from/<everything:name>', defaults = { 'tool' : 'star_doc_from' })(user_watch_list_name)
 

+ 5 - 4
route/__init__.py

@@ -140,7 +140,6 @@ from route.user_setting_skin_set_main import user_setting_skin_set_main
 from route.user_setting_top_menu import user_setting_top_menu
 from route.user_setting_user_name import user_setting_user_name
 
-from route.user_watch_list import user_watch_list
 from route.user_watch_list_name import user_watch_list_name
 
 from route.view_set import view_set
@@ -162,8 +161,6 @@ from route.n_list_recent_discuss import list_recent_discuss
 from route.n_list_recent_block import list_recent_block
 from route.n_list_user_check_submit import list_user_check_submit
 
-from route.n_w_watch_list import w_watch_list
-
 from route.n_topic_list import topic_list
 
 from route.n_give_auth import give_auth
@@ -222,4 +219,8 @@ from route.go_api_w_page_view import api_w_page_view
 
 from route.go_main_func_easter_egg import main_func_easter_egg
 
-from route.go_view_list_random import view_list_random
+from route.go_view_list_random import view_list_random
+
+from route.go_view_w_watch_list import view_w_watch_list
+
+from route.go_view_user_watch_list import view_user_watch_list

+ 11 - 0
route/go_view_user_watch_list.py

@@ -0,0 +1,11 @@
+from .tool.func import *
+
+async def view_user_watch_list(num = 1, do_type = 'watch_list'):
+    other_set = {}
+    other_set['name'] = ip_check()
+    other_set['num'] = str(num)
+    other_set['do_type'] = do_type
+
+    data = await python_to_golang(sys._getframe().f_code.co_name, other_set)
+
+    return data["data"]

+ 11 - 0
route/go_view_w_watch_list.py

@@ -0,0 +1,11 @@
+from .tool.func import *
+
+async def view_w_watch_list(name, num = 1, do_type = 'watch_list'):
+    other_set = {}
+    other_set['name'] = name
+    other_set['num'] = str(num)
+    other_set['do_type'] = do_type
+
+    data = await python_to_golang(sys._getframe().f_code.co_name, other_set)
+
+    return data["data"]

+ 0 - 12
route/n_w_watch_list.py

@@ -1,12 +0,0 @@
-from .tool.func import *
-
-async def w_watch_list(name, num = 1, do_type = 'watch_list'):
-    return easy_minify(flask.render_template(await skin_check(),
-        imp = [name, await wiki_set(), await wiki_custom(), wiki_css(['(' + await get_lang(do_type if do_type == 'star_doc' else 'watchlist') + ')', 0])],
-        data = '' + \
-            '<div id="opennamu_w_watch_list"></div>' + \
-            '<script defer src="/views/main_css/js/route/w_watch_list.js' + cache_v() + '"></script>' + \
-            '<script>window.addEventListener("DOMContentLoaded", function() { opennamu_w_watch_list(); });</script>' + \
-        '',
-        menu = [['w/' + url_pas(name), await get_lang('return')]]
-    ))

+ 0 - 50
route/user_watch_list.py

@@ -1,50 +0,0 @@
-from .tool.func import *
-
-async def user_watch_list(tool):
-    with get_db_connect() as conn:
-        curs = conn.cursor()
-
-        if tool == 'watch_list':
-            div = await get_lang("msg_whatchlist_lmt") + ' : 10 <hr class="main_hr">'
-        else:
-            div = ''
-
-        ip = ip_check()
-
-        if ip_or_user(ip) != 0:
-            return redirect(conn, '/login')
-
-        if tool == 'watch_list':
-            curs.execute(db_change("select data from user_set where name = 'watchlist' and id = ?"), [ip])
-            title_name = await get_lang('watchlist')
-        else:
-            curs.execute(db_change("select data from user_set where name = 'star_doc' and id = ?"), [ip])
-            title_name = await get_lang('star_doc')
-
-        data = curs.fetchall()
-        for data_list in data:
-            curs.execute(db_change("select date from history where title = ? order by id + 0 desc limit 1"), [data_list[0]])
-            get_data = curs.fetchall()
-            plus = '(' + get_data[0][0] + ') ' if get_data else ''
-            
-            div += '' + \
-                '<li>' + \
-                    '<a href="/w/' + url_pas(data_list[0]) + '">' + html.escape(data_list[0]) + '</a> ' + \
-                    plus + \
-                    '<a href="/' + ('star_doc' if tool == 'star_doc' else 'watch_list') + '/' + url_pas(data_list[0]) + '">(' + await get_lang('delete') + ')</a>' + \
-                '</li>' + \
-            ''
-
-        if data:
-            div = '' + \
-                '<ul>' + div + '</ul>' + \
-                '<hr class="main_hr">' + \
-            ''
-
-        div += '<a href="/manager/' + ('13' if tool == 'watch_list' else '16') + '">(' + await get_lang('add') + ')</a>'
-
-        return easy_minify(flask.render_template(await skin_check(),
-            imp = [title_name, await wiki_set(), await wiki_custom(), wiki_css([0, 0])],
-            data = div,
-            menu = [['user', await get_lang('return')]]
-        ))