ソースを参照

bbs post 파트 디렉토링

잉여개발기 (SPDV) 3 年 前
コミット
d52728dab5

+ 3 - 0
app.py

@@ -582,6 +582,9 @@ app.route('/api/w/<everything:name>/doc_tool/<tool>', methods = ['POST', 'GET'])
 app.route('/api/w/<everything:name>', methods = ['GET', 'POST'])(api_w)
 app.route('/api/raw/<everything:name>')(api_raw)
 
+app.route('/api/bbs/w/<sub_code>')(api_bbs_w_post)
+app.route('/api/bbs/w/comment/<sub_code>')(api_bbs_w_comment)
+
 app.route('/api/version', defaults = { 'version_list' : version_list })(api_version)
 app.route('/api/skin_info')(api_skin_info)
 app.route('/api/skin_info/<name>')(api_skin_info)

+ 2 - 0
route/__init__.py

@@ -12,6 +12,8 @@ from route.api_topic import api_topic
 from route.api_user_info import api_user_info
 from route.api_version import api_version
 from route.api_w import api_w
+from route.api_bbs_w_post import api_bbs_w_post
+from route.api_bbs_w_comment import api_bbs_w_comment
 
 from route.bbs_edit import bbs_edit
 from route.bbs_main import bbs_main

+ 30 - 0
route/api_bbs_w_comment.py

@@ -0,0 +1,30 @@
+from .tool.func import *
+
+def api_bbs_w_comment(sub_code : str = '') -> str:
+    conn : typing.Union[sqlite3.Connection, pymysql.connections.Connection, None]
+    with get_db_connect() as conn:
+        curs : typing.Union[sqlite3.Cursor, pymysql.cursors.Cursor, None] = conn.cursor()
+
+        curs.execute(db_change('select set_name, set_data, set_code, set_id from bbs_data where (set_name = "comment" or set_name = "comment_date" or set_name = "comment_user_id") and set_id = ? order by set_code + 0 asc'), [sub_code])
+        db_data : typing.Union[list[typing.Tuple[str, str, str]], None] = curs.fetchall()
+        if not db_data:
+            return flask.jsonify({})
+        else:
+            temp_id : str = ''
+            temp_dict : dict[str, str] = {}
+            temp_list : list[dict[str, str]] = []
+
+            for for_a in db_data:
+                if temp_id != for_a[2]:
+                    if temp_dict != {}:
+                        temp_list += [dict(temp_dict)]
+
+                    temp_id = for_a[2]
+                    temp_dict['code'] = for_a[2]
+
+                temp_dict[for_a[0]] = for_a[1]
+
+            if temp_dict != {}:
+                temp_list += [dict(temp_dict)]
+
+            return flask.jsonify(temp_list)

+ 27 - 0
route/api_bbs_w_post.py

@@ -0,0 +1,27 @@
+from .tool.func import *
+
+def api_bbs_w_post(sub_code : str = '') -> str:
+    sub_code : list[str] = sub_code.split('-')
+    if len(sub_code) < 2:
+        sub_code = ['', '']
+
+    conn : typing.Union[sqlite3.Connection, pymysql.connections.Connection, None]
+    with get_db_connect() as conn:
+        curs : typing.Union[sqlite3.Cursor, pymysql.cursors.Cursor, None] = conn.cursor()
+
+        curs.execute(db_change('select set_name, set_data, set_code from bbs_data where set_id = ? and set_code = ?'), [sub_code[0], sub_code[1]])
+        db_data : typing.Union[list[typing.Tuple[str, str, str]], None] = curs.fetchall()
+        if not db_data:
+            return flask.jsonify({})
+        else:
+            temp_id : str = ''
+            temp_dict : dict[str, str] = {}
+
+            for for_a in db_data:
+                if temp_id != for_a[2]:
+                    temp_id = for_a[2]
+                    temp_dict['code'] = for_a[2]
+
+                temp_dict[for_a[0]] = for_a[1]
+
+            return flask.jsonify(temp_dict)

+ 1 - 0
route/bbs_main.py

@@ -26,6 +26,7 @@ def bbs_main():
                 last_date = ('(' + db_data_2[0][0] + ')') if db_data_2 else ''
 
                 data += '<li><a href="/bbs/w/' + for_a[1] + '">' + for_a[0] + ' (' + bbs_type + ') ' + last_date + '</a></li>'
+                data += '<li></li>'
 
             data += '</ul>'
 

+ 134 - 161
route/bbs_w_post.py

@@ -1,6 +1,9 @@
 from .tool.func import *
 
-def bbs_w_post_make_thread(user_id, date, data, code, color = '', blind = '', add_style = ''):
+from .api_bbs_w_post import api_bbs_w_post
+from .api_bbs_w_comment import api_bbs_w_comment
+
+def bbs_w_post_make_thread(user_id : str, date : str, data : str, code : str, color : str = '', blind : str = '', add_style : str = '') -> str:
     if blind != '':
         if data == '':
             color_b = 'opennamu_comment_blind'
@@ -26,29 +29,79 @@ def bbs_w_post_make_thread(user_id, date, data, code, color = '', blind = '', ad
         </table>
     '''
 
-def bbs_w_post(bbs_num = '', post_num = '', do_type = ''):
+def bbs_w_post_comment(user_id : str, sub_code : str, comment_num : str) -> list[str, str, int, int]:
+    comment_data : str = ''
+    comment_select : str = ''
+
+    comment_count : int = 0
+    comment_add_count : int = 0
+
+    thread_data : list[dict[str, str]] = json.loads(api_bbs_w_comment(sub_code).data)
+    
+    comment_count += len(thread_data)
+    comment_add_count += comment_count
+
+    for temp_dict in thread_data:
+        color : str = 'default'
+        if user_id == temp_dict['comment_user_id']:
+            color = 'green'
+
+        sub_code_check : str = re.sub(r'^[0-9]+-[0-9]+-', '', sub_code + '-' + temp_dict['code'])
+        margin_count : int = sub_code_check.count('-')
+
+        comment_data += '<span style="padding-left: 20px;"></span>' * margin_count
+        comment_data += bbs_w_post_make_thread(
+            ip_pas(temp_dict['comment_user_id']),
+            temp_dict['comment_date'],
+            render_set(
+                doc_name = '', 
+                doc_data = temp_dict['comment'],
+                data_in = 'from'
+            ),
+            sub_code_check,
+            color = color,
+            add_style = 'width: calc(100% - ' + str(margin_count * 20) + 'px);'
+        )
+
+        comment_default : str = ''
+        if comment_num == sub_code_check:
+            comment_default = 'selected'
+
+        comment_select += '<option value="' + sub_code_check + '" ' + comment_default + '>' + sub_code_check + '</option>'
+        comment_data += '<hr class="main_hr">'
+
+        temp_data : list[str, str, int, int] = bbs_w_post_comment(user_id, sub_code + '-' + temp_dict['code'], comment_num)
+
+        comment_data += temp_data[0]
+        comment_select += temp_data[1]
+        comment_add_count += temp_data[3]
+
+    return [comment_data, comment_select, comment_count, comment_add_count]
+
+def bbs_w_post(bbs_num : typing.Union[int, str] = '', post_num : typing.Union[int, str] = '', do_type : str = ''):
+    conn : typing.Union[sqlite3.Connection, pymysql.connections.Connection, None]
     with get_db_connect() as conn:
-        curs = conn.cursor()
+        curs : typing.Union[sqlite3.Cursor, pymysql.cursors.Cursor, None] = conn.cursor()
 
         curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_name"'), [bbs_num])
-        db_data = curs.fetchall()
+        db_data : list[typing.Tuple[str]] = curs.fetchall()
         if not db_data:
             return redirect('/bbs/main')
         
-        bbs_name = db_data[0][0]
+        bbs_name : str = db_data[0][0]
 
         curs.execute(db_change('select set_name, set_data, set_code from bbs_data where set_id = ? and set_code = ?'), [bbs_num, post_num])
-        db_data = curs.fetchall()
+        db_data : list[typing.Tuple[str, str, str]] = curs.fetchall()
         if not db_data:
             return redirect('/bbs/main')
 
-        bbs_num_str = str(bbs_num)
-        post_num_str = str(post_num)
-        bbs_comment_acl = acl_check(bbs_num_str, 'bbs_comment')
-        ip = ip_check()
+        bbs_num_str : str = str(bbs_num)
+        post_num_str : str = str(post_num)
+        bbs_comment_acl : int = acl_check(bbs_num_str, 'bbs_comment')
+        ip : str = ip_check()
         
         curs.execute(db_change('select set_data from bbs_set where set_id = ? and set_name = "bbs_type"'), [bbs_num])
-        db_data_2 = curs.fetchall()
+        db_data_2 : list[typing.Tuple[str]] = curs.fetchall()
         if not db_data_2:
             return redirect('/bbs/main')
         elif db_data_2[0][0] == 'thread':
@@ -61,18 +114,18 @@ def bbs_w_post(bbs_num = '', post_num = '', do_type = ''):
                 else:
                     captcha_post('', 0)
 
-                set_id = bbs_num_str + '-' + post_num_str
+                set_id : str = bbs_num_str + '-' + post_num_str
 
                 curs.execute(db_change('select set_code from bbs_data where set_name = "comment" and set_id = ? order by set_code + 0 desc'), [set_id])
-                db_data = curs.fetchall()
-                id_data = str(int(db_data[0][0]) + 1) if db_data else '1'
+                db_data : list[typing.Tuple[str]] = curs.fetchall()
+                id_data : str = str(int(db_data[0][0]) + 1) if db_data else '1'
 
-                data = flask.request.form.get('content', '')
+                data : str = flask.request.form.get('content', '')
                 if data == '':
                     # re_error로 대체 예정
                     return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str)
                 
-                date = get_time()
+                date : str = get_time()
 
                 curs.execute(db_change("insert into bbs_data (set_name, set_code, set_id, set_data) values ('comment', ?, ?, ?)"), [id_data, set_id, data])
                 curs.execute(db_change("insert into bbs_data (set_name, set_code, set_id, set_data) values ('comment_date', ?, ?, ?)"), [id_data, set_id, date])
@@ -80,11 +133,13 @@ def bbs_w_post(bbs_num = '', post_num = '', do_type = ''):
 
                 conn.commit()
 
-                return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str + '#comment_' + str(int(id_data) + 1))
+                return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + str(int(id_data) + 1))
             else:
                 if acl_check(bbs_num_str, 'bbs_view') == 1:
                     return re_error('/ban')
 
+                text : str = ''
+                data_preview : str = ''
                 if do_type == 'preview':
                     text = flask.request.form.get('content', '')
                     text = text.replace('\r', '')
@@ -94,24 +149,10 @@ def bbs_w_post(bbs_num = '', post_num = '', do_type = ''):
                         doc_data = text,
                         data_in = 'from'
                     )
-                else:
-                    text = ''
-                    data_preview = ''
                 
-                temp_id = ''
-                temp_dict = {}
-
-                db_data = list(db_data) if db_data else []
-                for for_a in db_data + [['', '', '']]:
-                    if temp_id != for_a[2]:
-                        temp_id = for_a[2]
-                        temp_dict['code'] = for_a[2]
-
-                    temp_dict[for_a[0]] = for_a[1]
-
-                count = 1
+                temp_dict : dict[str, str] = json.loads(api_bbs_w_post(bbs_num_str + '-' + post_num_str).data)
 
-                data = ''
+                data : str = ''
                 data += '<h2>' + html.escape(temp_dict['title']) + '</h2>'
                 data += bbs_w_post_make_thread(
                     ip_pas(temp_dict['user_id']),
@@ -126,47 +167,33 @@ def bbs_w_post(bbs_num = '', post_num = '', do_type = ''):
                 )
                 data += '<hr class="main_hr">'
 
-                user_id = temp_dict['user_id']
+                user_id : str = temp_dict['user_id']
+                count : int = 1
 
-                temp_id = ''
-                temp_dict = {}
-
-                curs.execute(db_change('select set_name, set_data, set_code, set_id from bbs_data where (set_name = "comment" or set_name = "comment_date" or set_name = "comment_user_id") and set_id = ? order by set_code + 0 asc'), [bbs_num_str + '-' + post_num_str])
-                db_data = curs.fetchall()
-                db_data = list(db_data) if db_data else []
-
-                for for_a in db_data + [['', '', '']]:
-                    if temp_id == '':
-                        temp_id = for_a[2]
-
-                    if temp_id != for_a[2]:
-                        temp_id = for_a[2]
-                        temp_dict['code'] = for_a[2]
-                        count += 1
+                thread_data : list[dict[str, str]] = json.loads(api_bbs_w_comment(bbs_num_str + '-' + post_num_str).data)
+                for temp_dict in thread_data:
+                    count += 1
+                    if user_id == temp_dict['comment_user_id']:
+                        color = 'green'
+                    else:
+                        color = 'default'
+
+                    data += bbs_w_post_make_thread(
+                        ip_pas(temp_dict['comment_user_id']),
+                        temp_dict['comment_date'],
+                        render_set(
+                            doc_name = '', 
+                            doc_data = temp_dict['comment'],
+                            data_in = 'from'
+                        ),
+                        str(count),
+                        color = color
+                    )
+                    data += '<hr class="main_hr">'
 
-                        if user_id == temp_dict['comment_user_id']:
-                            color = 'green'
-                        else:
-                            color = 'default'
-
-                        data += bbs_w_post_make_thread(
-                            ip_pas(temp_dict['comment_user_id']),
-                            temp_dict['comment_date'],
-                            render_set(
-                                doc_name = '', 
-                                doc_data = temp_dict['comment'],
-                                data_in = 'from'
-                            ),
-                            str(count),
-                            color = color
-                        )
-                        data += '<hr class="main_hr">'
-
-                    temp_dict[for_a[0]] = for_a[1]
-
-                bbs_comment_form = ''
+                bbs_comment_form : str = ''
                 if bbs_comment_acl == 0:
-                    bbs_comment_form = '''                        
+                    bbs_comment_form += '''                        
                         <textarea name="content" id="opennamu_edit_textarea" class="opennamu_textarea_100">''' + html.escape(text) + '''</textarea>
                         <hr class="main_hr">
                         
@@ -200,35 +227,35 @@ def bbs_w_post(bbs_num = '', post_num = '', do_type = ''):
                 else:
                     captcha_post('', 0)
                 
-                select = flask.request.form.get('comment_select', 'default')
-                select = '' if select == 'default' else select
+                select : str = flask.request.form.get('comment_select', 'default')
+                select : str = '' if select == 'default' else select
                 if select != '':
-                    select = select.split('-')
+                    select : list[str] = select.split('-')
                     if len(select) < 2:
                         curs.execute(db_change('select set_code from bbs_data where set_name = "comment" and set_id = ? and set_code = ? limit 1'), [bbs_num_str + '-' + post_num_str, select[0]])
                         if not curs.fetchall():
                             return ''
                         else:
-                            set_id = bbs_num_str + '-' + post_num_str + '-' + select[0]
+                            set_id : str = bbs_num_str + '-' + post_num_str + '-' + select[0]
                     else:
                         curs.execute(db_change('select set_code from bbs_data where set_name = "comment" and set_id = ? and set_code = ? limit 1'), [bbs_num_str + '-' + post_num_str + '-' + '-'.join(select[0:len(select) - 1]), select[len(select) - 1]])
                         if not curs.fetchall():
                             return ''
                         else:
-                            set_id = bbs_num_str + '-' + post_num_str + '-' + '-'.join(select)
+                            set_id : str = bbs_num_str + '-' + post_num_str + '-' + '-'.join(select)
                 else:
-                    set_id = bbs_num_str + '-' + post_num_str
+                    set_id : str = bbs_num_str + '-' + post_num_str
 
                 curs.execute(db_change('select set_code from bbs_data where set_name = "comment" and set_id = ? order by set_code + 0 desc'), [set_id])
-                db_data = curs.fetchall()
-                id_data = str(int(db_data[0][0]) + 1) if db_data else '1'
+                db_data : list[typing.Tuple[str]] = curs.fetchall()
+                id_data : str = str(int(db_data[0][0]) + 1) if db_data else '1'
 
-                data = flask.request.form.get('content', '')
+                data : str = flask.request.form.get('content', '')
                 if data == '':
                     # re_error로 대체 예정
                     return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str)
 
-                date = get_time()
+                date : str = get_time()
 
                 curs.execute(db_change("insert into bbs_data (set_name, set_code, set_id, set_data) values ('comment', ?, ?, ?)"), [id_data, set_id, data])
                 curs.execute(db_change("insert into bbs_data (set_name, set_code, set_id, set_data) values ('comment_date', ?, ?, ?)"), [id_data, set_id, date])
@@ -237,39 +264,32 @@ def bbs_w_post(bbs_num = '', post_num = '', do_type = ''):
                 conn.commit()
             
                 if set_id == '':
-                    return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str + '#comment_' + id_data)
+                    return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + id_data)
                 else:
                     set_id = re.sub(r'^[0-9]+-[0-9]+-?', '', set_id)
-                    return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str + '#comment_' + set_id + '-' + id_data)
+                    return redirect('/bbs/w/' + bbs_num_str + '/' + post_num_str + '#' + set_id + '-' + id_data)
             else:
                 if acl_check(bbs_num_str, 'bbs_view') == 1:
                     return re_error('/ban')
                     
+                text : str = ''
+                comment_num : str = ''
+                data_preview : str = ''
                 if do_type == 'preview':
                     text = flask.request.form.get('content', '')
                     text = text.replace('\r', '')
 
+                    comment_num = flask.request.form.get('comment_select', '')
+
                     data_preview = render_set(
                         doc_name = '', 
                         doc_data = text,
                         data_in = 'from'
                     )
-                else:
-                    text = ''
-                    data_preview = ''
-
-                temp_id = ''
-                temp_dict = {}
-
-                db_data = list(db_data) if db_data else []
-                for for_a in db_data + [['', '', '']]:
-                    if temp_id != for_a[2]:
-                        temp_id = for_a[2]
-                        temp_dict['code'] = for_a[2]
 
-                    temp_dict[for_a[0]] = for_a[1]
+                temp_dict : dict[str, str] = json.loads(api_bbs_w_post(bbs_num_str + '-' + post_num_str).data)
 
-                data = ''
+                data : str = ''
                 data += '<h2>' + html.escape(temp_dict['title']) + '</h2>'
                 data += bbs_w_post_make_thread(
                     ip_pas(temp_dict['user_id']),
@@ -283,72 +303,25 @@ def bbs_w_post(bbs_num = '', post_num = '', do_type = ''):
                     color = 'red'
                 )
 
-                user_id = temp_dict['user_id']
-                temp_id = ''
-                temp_dict = {}
-                comment_data = ''
+                user_id : str = temp_dict['user_id']
+                comment_data : str = ''
 
-                comment_select = '<hr class="main_hr"><select name="comment_select">'
+                comment_select : str = '<hr class="main_hr"><select name="comment_select">'
                 comment_select += '<option value="default">' + load_lang('normal') + '</option>'
 
-                curs.execute(db_change('select set_name, set_data, set_code, set_id from bbs_data where (set_name = "comment" or set_name = "comment_date" or set_name = "comment_user_id") and set_id = ? order by set_code + 0 asc'), [bbs_num_str + '-' + post_num_str])
-                db_data = curs.fetchall()
-                if db_data:
+                comment_count : int = 0
+                comment_add_count : int = 0
+
+                temp_data : list[typing.Tuple[str, str]] = bbs_w_post_comment(user_id, bbs_num_str + '-' + post_num_str, comment_num)
+
+                comment_data += temp_data[0]
+                comment_select += temp_data[1]
+                comment_count += temp_data[2]
+                comment_add_count += temp_data[3]
+                comment_add_count -= comment_count
+
+                if comment_data != '':
                     data += '<hr class="main_hr"><hr>'
-                else:
-                    db_data = []
-
-                for_a = 0
-                db_data_2 = db_data + [['', '', '', '']]
-                db_data_len = len(db_data_2)
-                comment_count = 0
-                comment_add_count = 0
-                while(for_a < db_data_len):
-                    if temp_id != (db_data_2[for_a][3] + '-' + db_data_2[for_a][2]):
-                        if temp_id != '':
-                            temp_dict['code'] = temp_id
-                            temp_dict['code'] = re.sub(r'^[0-9]+-[0-9]+-', '', temp_dict['code'])
-
-                            if user_id == temp_dict['comment_user_id']:
-                                color = 'green'
-                            else:
-                                color = 'default'
-
-                            margin_count = temp_dict['code'].count('-')
-                            if margin_count == 0:
-                                comment_count += 1
-                            else:
-                                comment_add_count += 1
-
-                            comment_data += '<span style="padding-left: 20px;"></span>' * margin_count
-                            comment_data += bbs_w_post_make_thread(
-                                ip_pas(temp_dict['comment_user_id']),
-                                temp_dict['comment_date'],
-                                render_set(
-                                    doc_name = '', 
-                                    doc_data = temp_dict['comment'],
-                                    data_in = 'from'
-                                ),
-                                temp_dict['code'],
-                                color = color,
-                                add_style = 'width: calc(100% - ' + str(margin_count * 20) + 'px);'
-                            )
-
-                            comment_select += '<option value="' + temp_dict['code'] + '">' + temp_dict['code'] + '</option>'
-
-                            curs.execute(db_change('select set_name, set_data, set_code, set_id from bbs_data where (set_name = "comment" or set_name = "comment_date" or set_name = "comment_user_id") and set_id = ? order by set_code + 0 asc'), [bbs_num_str + '-' + post_num_str + '-' + temp_dict['code']])
-                            db_data = curs.fetchall()
-                            if db_data:
-                                db_data_2 = db_data_2[:for_a] + db_data + db_data_2[for_a:]
-                                db_data_len += len(db_data)
-
-                            if db_data_2[for_a][0] != '':
-                                comment_data += '<hr class="main_hr">'
-
-                        temp_id = db_data_2[for_a][3] + '-' + db_data_2[for_a][2]
-
-                    temp_dict[db_data_2[for_a][0]] = db_data_2[for_a][1]
-                    for_a += 1
 
                 comment_select += '</select>'
                 if comment_data != '':
@@ -356,9 +329,9 @@ def bbs_w_post(bbs_num = '', post_num = '', do_type = ''):
                     data += load_lang('reply') + ' : ' + str(comment_add_count) + '<hr class="main_hr">'
                     data += comment_data
 
-                bbs_comment_form = ''
+                bbs_comment_form : str = ''
                 if bbs_comment_acl == 0:
-                    bbs_comment_form = '''
+                    bbs_comment_form += '''
                         ''' + comment_select + '''
                         <hr class="main_hr">
                         

+ 3 - 1
route/edit_delete_file.py

@@ -1,11 +1,13 @@
 from .tool.func import *
+
 from .edit_delete import edit_delete
 
 # 처음으로 차세대 코드 방법론 적용
 # 앞으로 다 이렇게 작성할 예정
 def edit_delete_file(name : str = 'test.jpg') -> str:
+    conn : typing.Union[sqlite3.Connection, pymysql.connections.Connection, None]
     with get_db_connect() as conn:
-        curs : typing.Union[sqlite3.dbapi2.Cursor, pymysql.cursors.Cursor, None] = conn.cursor()
+        curs : typing.Union[sqlite3.Cursor, pymysql.cursors.Cursor, None] = conn.cursor()
 
         ip : str = ip_check()
         if admin_check() == 0:

+ 1 - 0
route/edit_delete_multiple.py

@@ -1,4 +1,5 @@
 from .tool.func import *
+
 from .edit_delete import edit_delete
 
 def edit_delete_multiple():

+ 1 - 0
route/tool/func_render.py

@@ -1,4 +1,5 @@
 from .func_tool import *
+
 from .func_render_namumark import class_do_render_namumark
 
 # 커스텀 마크 언젠간 다시 추가 예정

+ 1 - 1
route/tool/func_render_namumark.py

@@ -2020,10 +2020,10 @@ class class_do_render_namumark:
             self.do_render_list()
             self.do_render_macro()
             self.do_render_link()
-            self.do_redner_footnote()
             self.do_render_text()
             self.do_render_hr()
             self.do_render_heading()
+            self.do_redner_footnote()
             
         self.do_render_last()
 

+ 1 - 0
route/topic.py

@@ -1,4 +1,5 @@
 from .tool.func import *
+
 from .api_topic import api_topic
 
 def topic(topic_num = 0, do_type = '', doc_name = 'Test'):