Jelajahi Sumber

long, short, old, new list

잉여개발기 2 bulan lalu
induk
melakukan
9ccec5445c
4 mengubah file dengan 8 tambahan dan 76 penghapusan
  1. 8 8
      app.py
  2. 0 2
      route/__init__.py
  3. 0 33
      route/list_long_page.py
  4. 0 33
      route/list_old_page.py

+ 8 - 8
app.py

@@ -586,11 +586,11 @@ app.route('/filter/extension_filter/add', methods = ['POST', 'GET'], defaults =
 app.route('/filter/extension_filter/del/<everything:name>', defaults = { 'tool' : 'extension_filter' })(filter_all_delete)
 
 # Func-list
-app.route('/list/document/old', defaults = { 'set_type' : 'old' })(list_old_page)
-app.route('/list/document/old/<int:num>', defaults = { 'set_type' : 'old' })(list_old_page)
+app.route('/list/document/old')(golang_view())
+app.route('/list/document/old/<int:num>')(golang_view())
 
-app.route('/list/document/new', defaults = { 'set_type' : 'new' })(list_old_page)
-app.route('/list/document/new/<int:num>', defaults = { 'set_type' : 'new' })(list_old_page)
+app.route('/list/document/new')(golang_view())
+app.route('/list/document/new/<int:num>')(golang_view())
 
 app.route('/list/document/no_link')(list_no_link)
 app.route('/list/document/no_link/<int:num>')(list_no_link)
@@ -604,11 +604,11 @@ app.route('/list/document/need/<int:arg_num>')(list_please)
 app.route('/list/document/all')(list_title_index)
 app.route('/list/document/all/<int:num>')(list_title_index)
 
-app.route('/list/document/long')(list_long_page)
-app.route('/list/document/long/<int:arg_num>')(list_long_page)
+app.route('/list/document/long')(golang_view())
+app.route('/list/document/long/<int:arg_num>')(golang_view())
 
-app.route('/list/document/short', defaults = { 'tool' : 'short_page' })(list_long_page)
-app.route('/list/document/short/<int:arg_num>', defaults = { 'tool' : 'short_page' })(list_long_page)
+app.route('/list/document/short')(golang_view())
+app.route('/list/document/short/<int:arg_num>')(golang_view())
 
 app.route('/list/file')(list_image_file)
 app.route('/list/file/<int:arg_num>')(list_image_file)

+ 0 - 2
route/__init__.py

@@ -37,10 +37,8 @@ from route.give_user_fix import give_user_fix
 from route.list_acl import list_acl
 from route.list_admin import list_admin
 from route.list_admin_auth_use import list_admin_auth_use
-from route.list_old_page import list_old_page
 from route.list_admin_group import list_admin_group
 from route.list_image_file import list_image_file
-from route.list_long_page import list_long_page
 from route.list_no_link import list_no_link
 from route.list_please import list_please
 from route.list_title_index import list_title_index

+ 0 - 33
route/list_long_page.py

@@ -1,33 +0,0 @@
-from .tool.func import *
-
-async def list_long_page(tool = 'long_page', arg_num = 1):
-    with get_db_connect() as conn:
-        curs = conn.cursor()
-
-        sql_num = (arg_num * 50 - 50) if arg_num * 50 > 0 else 0
-
-        div = '<ul>'
-        select_data = 'desc' if tool == 'long_page' else 'asc'
-        title = 'long_page' if tool == 'long_page' else 'short_page'
-
-        curs.execute(db_change("select doc_name, set_data from data_set where set_name = 'length' and doc_rev = '' order by set_data + 0 " + select_data + " limit ?, 50"), [sql_num])
-        n_list = curs.fetchall()
-        for data in n_list:
-            div += '<li>'
-            div += data[1] + ' | <a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a>'
-            
-            curs.execute(db_change("select set_data from data_set where doc_name = ? and set_name = 'doc_type'"), [data[0]])
-            db_data = curs.fetchall()
-            if db_data and db_data[0][0] != '':
-                div += ' | ' + db_data[0][0]
-
-            div += '</li>'
-
-        div += '</ul>' + await get_next_page_bottom('/list/document/' + ('long' if title == 'long_page' else 'short') + '/{}', arg_num, n_list)
-
-        return await render_template(
-            await get_lang(title),
-            div,
-            0,
-            [['other', await get_lang('return')]]
-        )

+ 0 - 33
route/list_old_page.py

@@ -1,33 +0,0 @@
-from .tool.func import *
-
-from .go_api_list_old_page import api_list_old_page
-
-async def list_old_page(num = 1, set_type = 'old'):
-    with get_db_connect() as conn:
-        title = ''
-        if set_type == 'old':
-            title = await get_lang('old_page')
-        else:
-            title = await get_lang('new_page')
-
-        data = await api_list_old_page(num, set_type)
-        data = data["data"]
-
-        data_html = ''
-
-        for for_a in range(len(data)):
-            doc_name_encoded = url_pas(data[for_a][0])
-            doc_title_filtered = html.escape(data[for_a][0])
-
-            right = f'<a href="/w/{doc_name_encoded}">{doc_title_filtered}</a> '
-
-            data_html += await opennamu_make_list(right, data[for_a][1])
-
-        data_html += await get_next_page_bottom(f'/list/document/{set_type}/{{}}', int(num), data)
-
-        return await render_template(
-            title,
-            data_html,
-            0,
-            [['other', await get_lang('return')]]
-        )