from .tool.func import * async def topic_list(name = 'Test'): with get_db_connect() as conn: curs = conn.cursor() div = '' tool = flask.request.args.get('tool', '') plus = '' menu = [['topic/' + url_pas(name), await get_lang('return')]] if tool == 'close': curs.execute(db_change("select code, sub from rd where title = ? and stop = 'O' order by sub asc"), [name]) sub = await get_lang('closed_discussion') elif tool == 'agree': curs.execute(db_change("select code, sub from rd where title = ? and agree = 'O' order by sub asc"), [name]) sub = await get_lang('agreed_discussion') else: sub = await get_lang('discussion_list') menu = [['w/' + url_pas(name), await get_lang('document')]] plus = ''' (' + await get_lang('closed_discussion') + ''') (' + await get_lang('agreed_discussion') + ''')
(''' + await get_lang('make_new_topic') + ''') ''' curs.execute(db_change("select code, sub from rd where title = ? and stop != 'O' order by date desc"), [name]) for data in curs.fetchall(): div += '

' + data[0] + '. ' + html.escape(data[1]) + '

' if div == '': plus = re.sub(r'^
', '', plus) return await render_template( name, div + plus, '(' + sub + ')', menu )