repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
bukun/TorCMS | torcms/model/post_model.py | MPost.query_recent | def query_recent(num=8, **kwargs):
'''
query recent posts.
'''
order_by_create = kwargs.get('order_by_create', False)
kind = kwargs.get('kind', None)
if order_by_create:
if kind:
recent_recs = TabPost.select().where(
(TabPos... | python | def query_recent(num=8, **kwargs):
'''
query recent posts.
'''
order_by_create = kwargs.get('order_by_create', False)
kind = kwargs.get('kind', None)
if order_by_create:
if kind:
recent_recs = TabPost.select().where(
(TabPos... | query recent posts. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L272-L304 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_all | def query_all(**kwargs):
'''
query all the posts.
'''
kind = kwargs.get('kind', '1')
limit = kwargs.get('limit', 10)
return TabPost.select().where(
(TabPost.kind == kind) &
(TabPost.valid == 1)
).order_by(
TabPost.time_update.d... | python | def query_all(**kwargs):
'''
query all the posts.
'''
kind = kwargs.get('kind', '1')
limit = kwargs.get('limit', 10)
return TabPost.select().where(
(TabPost.kind == kind) &
(TabPost.valid == 1)
).order_by(
TabPost.time_update.d... | query all the posts. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L307-L319 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_keywords_empty | def query_keywords_empty(kind='1'):
'''
Query keywords, empty.
'''
return TabPost.select().where((TabPost.kind == kind) & (TabPost.keywords == '')) | python | def query_keywords_empty(kind='1'):
'''
Query keywords, empty.
'''
return TabPost.select().where((TabPost.kind == kind) & (TabPost.keywords == '')) | Query keywords, empty. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L322-L326 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_recent_edited | def query_recent_edited(timstamp, kind='1'):
'''
Query posts recently update.
'''
return TabPost.select().where(
(TabPost.kind == kind) &
(TabPost.time_update > timstamp)
).order_by(
TabPost.time_update.desc()
) | python | def query_recent_edited(timstamp, kind='1'):
'''
Query posts recently update.
'''
return TabPost.select().where(
(TabPost.kind == kind) &
(TabPost.time_update > timstamp)
).order_by(
TabPost.time_update.desc()
) | Query posts recently update. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L329-L338 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_dated | def query_dated(num=8, kind='1'):
'''
Query posts, outdate.
'''
return TabPost.select().where(
TabPost.kind == kind
).order_by(
TabPost.time_update.asc()
).limit(num) | python | def query_dated(num=8, kind='1'):
'''
Query posts, outdate.
'''
return TabPost.select().where(
TabPost.kind == kind
).order_by(
TabPost.time_update.asc()
).limit(num) | Query posts, outdate. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L341-L349 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_most_pic | def query_most_pic(num, kind='1'):
'''
Query most pics.
'''
return TabPost.select().where(
(TabPost.kind == kind) & (TabPost.logo != "")
).order_by(TabPost.view_count.desc()).limit(num) | python | def query_most_pic(num, kind='1'):
'''
Query most pics.
'''
return TabPost.select().where(
(TabPost.kind == kind) & (TabPost.logo != "")
).order_by(TabPost.view_count.desc()).limit(num) | Query most pics. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L352-L358 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_cat_recent | def query_cat_recent(cat_id, label=None, num=8, kind='1', order=False):
'''
Query recent posts of catalog.
'''
if label:
recent_recs = MPost.query_cat_recent_with_label(
cat_id,
label=label,
num=num,
kind=kind,
... | python | def query_cat_recent(cat_id, label=None, num=8, kind='1', order=False):
'''
Query recent posts of catalog.
'''
if label:
recent_recs = MPost.query_cat_recent_with_label(
cat_id,
label=label,
num=num,
kind=kind,
... | Query recent posts of catalog. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L361-L381 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_by_tag | def query_by_tag(cat_id, kind='1'):
'''
Query recent posts of catalog.
'''
return TabPost.select().join(
TabPost2Tag,
on=(TabPost.uid == TabPost2Tag.post_id)
).where(
(TabPost.kind == kind) &
(TabPost2Tag.tag_id == cat_id)
... | python | def query_by_tag(cat_id, kind='1'):
'''
Query recent posts of catalog.
'''
return TabPost.select().join(
TabPost2Tag,
on=(TabPost.uid == TabPost2Tag.post_id)
).where(
(TabPost.kind == kind) &
(TabPost2Tag.tag_id == cat_id)
... | Query recent posts of catalog. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L384-L397 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_cat_recent_with_label | def query_cat_recent_with_label(cat_id, label=None, num=8, kind='1', order=False):
'''
query_cat_recent_with_label
'''
if order:
sort_criteria = TabPost.order.asc()
else:
sort_criteria = TabPost.time_create.desc()
return TabPost.select().join(
... | python | def query_cat_recent_with_label(cat_id, label=None, num=8, kind='1', order=False):
'''
query_cat_recent_with_label
'''
if order:
sort_criteria = TabPost.order.asc()
else:
sort_criteria = TabPost.time_create.desc()
return TabPost.select().join(
... | query_cat_recent_with_label | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L400-L418 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_total_cat_recent | def query_total_cat_recent(cat_id_arr, label=None, num=8, kind='1'):
'''
:param cat_id_arr: list of categories. ['0101', '0102']
:param label: the additional label
'''
if label:
return MPost.__query_with_label(
cat_id_arr,
label=label... | python | def query_total_cat_recent(cat_id_arr, label=None, num=8, kind='1'):
'''
:param cat_id_arr: list of categories. ['0101', '0102']
:param label: the additional label
'''
if label:
return MPost.__query_with_label(
cat_id_arr,
label=label... | :param cat_id_arr: list of categories. ['0101', '0102']
:param label: the additional label | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L441-L453 |
bukun/TorCMS | torcms/model/post_model.py | MPost.__query_with_label | def __query_with_label(cat_id_arr, label=None, num=8, kind='1'):
'''
:param cat_id_arr: list of categories. ['0101', '0102']
'''
return TabPost.select().join(
TabPost2Tag,
on=(TabPost.uid == TabPost2Tag.post_id)
).where(
(TabPost.kind == kind... | python | def __query_with_label(cat_id_arr, label=None, num=8, kind='1'):
'''
:param cat_id_arr: list of categories. ['0101', '0102']
'''
return TabPost.select().join(
TabPost2Tag,
on=(TabPost.uid == TabPost2Tag.post_id)
).where(
(TabPost.kind == kind... | :param cat_id_arr: list of categories. ['0101', '0102'] | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L456-L469 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_total_cat_recent_no_label | def query_total_cat_recent_no_label(cat_id_arr, num=8, kind='1'):
'''
:param cat_id_arr: list of categories. ['0101', '0102']
'''
return TabPost.select().join(
TabPost2Tag,
on=(TabPost.uid == TabPost2Tag.post_id)
).where(
(TabPost.kind == kin... | python | def query_total_cat_recent_no_label(cat_id_arr, num=8, kind='1'):
'''
:param cat_id_arr: list of categories. ['0101', '0102']
'''
return TabPost.select().join(
TabPost2Tag,
on=(TabPost.uid == TabPost2Tag.post_id)
).where(
(TabPost.kind == kin... | :param cat_id_arr: list of categories. ['0101', '0102'] | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L472-L484 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_most | def query_most(num=8, kind='1'):
'''
Query most viewed.
'''
return TabPost.select().where(
(TabPost.kind == kind) &
(TabPost.valid == 1)
).order_by(
TabPost.view_count.desc()
).limit(num) | python | def query_most(num=8, kind='1'):
'''
Query most viewed.
'''
return TabPost.select().where(
(TabPost.kind == kind) &
(TabPost.valid == 1)
).order_by(
TabPost.view_count.desc()
).limit(num) | Query most viewed. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L487-L496 |
bukun/TorCMS | torcms/model/post_model.py | MPost.update_misc | def update_misc(uid, **kwargs):
'''
update rating, kind, or count
'''
if 'rating' in kwargs:
MPost.__update_rating(uid, kwargs['rating'])
elif 'kind' in kwargs:
MPost.__update_kind(uid, kwargs['kind'])
elif 'keywords' in kwargs:
MPost._... | python | def update_misc(uid, **kwargs):
'''
update rating, kind, or count
'''
if 'rating' in kwargs:
MPost.__update_rating(uid, kwargs['rating'])
elif 'kind' in kwargs:
MPost.__update_kind(uid, kwargs['kind'])
elif 'keywords' in kwargs:
MPost._... | update rating, kind, or count | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L499-L510 |
bukun/TorCMS | torcms/model/post_model.py | MPost.__update_keywords | def __update_keywords(uid, inkeywords):
'''
Update with keywords.
'''
entry = TabPost.update(keywords=inkeywords).where(TabPost.uid == uid)
entry.execute() | python | def __update_keywords(uid, inkeywords):
'''
Update with keywords.
'''
entry = TabPost.update(keywords=inkeywords).where(TabPost.uid == uid)
entry.execute() | Update with keywords. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L524-L529 |
bukun/TorCMS | torcms/model/post_model.py | MPost.get_next_record | def get_next_record(in_uid, kind='1'):
'''
Get next record by time_create.
'''
current_rec = MPost.get_by_uid(in_uid)
recs = TabPost.select().where(
(TabPost.kind == kind) &
(TabPost.time_create < current_rec.time_create)
).order_by(TabPost.time_cr... | python | def get_next_record(in_uid, kind='1'):
'''
Get next record by time_create.
'''
current_rec = MPost.get_by_uid(in_uid)
recs = TabPost.select().where(
(TabPost.kind == kind) &
(TabPost.time_create < current_rec.time_create)
).order_by(TabPost.time_cr... | Get next record by time_create. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L532-L543 |
bukun/TorCMS | torcms/model/post_model.py | MPost.get_all | def get_all(kind='2'):
'''
Get All the records.
'''
return TabPost.select().where(
(TabPost.kind == kind) &
(TabPost.valid == 1)
).order_by(
TabPost.time_update.desc()
) | python | def get_all(kind='2'):
'''
Get All the records.
'''
return TabPost.select().where(
(TabPost.kind == kind) &
(TabPost.valid == 1)
).order_by(
TabPost.time_update.desc()
) | Get All the records. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L560-L569 |
bukun/TorCMS | torcms/model/post_model.py | MPost.update_jsonb | def update_jsonb(uid, extinfo):
'''
Update the json.
'''
cur_extinfo = MPost.get_by_uid(uid).extinfo
for key in extinfo:
cur_extinfo[key] = extinfo[key]
entry = TabPost.update(
extinfo=cur_extinfo,
).where(TabPost.uid == uid)
entry.... | python | def update_jsonb(uid, extinfo):
'''
Update the json.
'''
cur_extinfo = MPost.get_by_uid(uid).extinfo
for key in extinfo:
cur_extinfo[key] = extinfo[key]
entry = TabPost.update(
extinfo=cur_extinfo,
).where(TabPost.uid == uid)
entry.... | Update the json. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L572-L583 |
bukun/TorCMS | torcms/model/post_model.py | MPost.modify_meta | def modify_meta(uid, data_dic, extinfo=None):
'''
update meta of the rec.
'''
if extinfo is None:
extinfo = {}
title = data_dic['title'].strip()
if len(title) < 2:
return False
cur_info = MPost.get_by_uid(uid)
if cur_info:
... | python | def modify_meta(uid, data_dic, extinfo=None):
'''
update meta of the rec.
'''
if extinfo is None:
extinfo = {}
title = data_dic['title'].strip()
if len(title) < 2:
return False
cur_info = MPost.get_by_uid(uid)
if cur_info:
... | update meta of the rec. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L586-L637 |
bukun/TorCMS | torcms/model/post_model.py | MPost.modify_init | def modify_init(uid, data_dic):
'''
update when init.
'''
postinfo = MPost.get_by_uid(uid)
entry = TabPost.update(
time_update=tools.timestamp(),
date=datetime.now(),
kind=data_dic['kind'] if 'kind' in data_dic else postinfo.kind,
k... | python | def modify_init(uid, data_dic):
'''
update when init.
'''
postinfo = MPost.get_by_uid(uid)
entry = TabPost.update(
time_update=tools.timestamp(),
date=datetime.now(),
kind=data_dic['kind'] if 'kind' in data_dic else postinfo.kind,
k... | update when init. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L640-L652 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_under_condition | def query_under_condition(condition, kind='2'):
'''
Get All data of certain kind according to the condition
'''
if DB_CFG['kind'] == 's':
return TabPost.select().where(
(TabPost.kind == kind) & (TabPost.valid == 1)
).order_by(
TabPo... | python | def query_under_condition(condition, kind='2'):
'''
Get All data of certain kind according to the condition
'''
if DB_CFG['kind'] == 's':
return TabPost.select().where(
(TabPost.kind == kind) & (TabPost.valid == 1)
).order_by(
TabPo... | Get All data of certain kind according to the condition | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L771-L786 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_list_pager | def query_list_pager(con, idx, kind='2'):
'''
Get records of certain pager.
'''
all_list = MPost.query_under_condition(con, kind=kind)
return all_list[(idx - 1) * CMS_CFG['list_num']: idx * CMS_CFG['list_num']] | python | def query_list_pager(con, idx, kind='2'):
'''
Get records of certain pager.
'''
all_list = MPost.query_under_condition(con, kind=kind)
return all_list[(idx - 1) * CMS_CFG['list_num']: idx * CMS_CFG['list_num']] | Get records of certain pager. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L830-L835 |
bukun/TorCMS | torcms/model/post_model.py | MPost.count_of_certain_kind | def count_of_certain_kind(kind):
'''
Get the count of certain kind.
'''
recs = TabPost.select().where(TabPost.kind == kind)
return recs.count() | python | def count_of_certain_kind(kind):
'''
Get the count of certain kind.
'''
recs = TabPost.select().where(TabPost.kind == kind)
return recs.count() | Get the count of certain kind. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L838-L845 |
bukun/TorCMS | torcms/model/post_model.py | MPost.query_pager_by_slug | def query_pager_by_slug(kind, current_page_num=1):
'''
Query pager
'''
return TabPost.select().where(TabPost.kind == kind).order_by(
TabPost.time_create.desc()
).paginate(
current_page_num, CMS_CFG['list_num']
) | python | def query_pager_by_slug(kind, current_page_num=1):
'''
Query pager
'''
return TabPost.select().where(TabPost.kind == kind).order_by(
TabPost.time_create.desc()
).paginate(
current_page_num, CMS_CFG['list_num']
) | Query pager | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/post_model.py#L855-L863 |
bukun/TorCMS | ext_script/script_gen_xlsx.py | gen_xlsx_table | def gen_xlsx_table():
'''
excel中的数据作为表中的字段,创建表
'''
XLSX_FILE = './database/esheet/20180811.xlsx'
if os.path.exists(XLSX_FILE):
pass
else:
return
fields = []
for sheet_ranges in load_workbook(filename=XLSX_FILE):
for xr in FILTER_COLUMNS:
row1_val =... | python | def gen_xlsx_table():
'''
excel中的数据作为表中的字段,创建表
'''
XLSX_FILE = './database/esheet/20180811.xlsx'
if os.path.exists(XLSX_FILE):
pass
else:
return
fields = []
for sheet_ranges in load_workbook(filename=XLSX_FILE):
for xr in FILTER_COLUMNS:
row1_val =... | excel中的数据作为表中的字段,创建表 | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/ext_script/script_gen_xlsx.py#L10-L40 |
bukun/TorCMS | torcms/handlers/leaf_handler.py | LeafHandler.viewinfo | def viewinfo(self, postinfo):
'''
In infor.
'''
self.redirect_kind(postinfo)
if DB_CFG['kind'] == 's':
cat_enum1 = []
else:
ext_catid = postinfo.extinfo['def_cat_uid'] if 'def_cat_uid' in postinfo.extinfo else ''
ext_catid2 = postinfo... | python | def viewinfo(self, postinfo):
'''
In infor.
'''
self.redirect_kind(postinfo)
if DB_CFG['kind'] == 's':
cat_enum1 = []
else:
ext_catid = postinfo.extinfo['def_cat_uid'] if 'def_cat_uid' in postinfo.extinfo else ''
ext_catid2 = postinfo... | In infor. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/leaf_handler.py#L69-L117 |
bukun/TorCMS | torcms/script/autocrud/gen_html_file.py | __get_view_tmpl | def __get_view_tmpl(tag_key):
'''
根据分类uid的4位编码来找模板。如果4位的存在,则使用4位的;不然找其父类;再不然则使用通用模板
只有View需要,edit, list使用通用模板
:return String.
'''
the_view_file_4 = './templates/tmpl_{0}/tpl_view_{1}.html'.format(
KIND_DICS['kind_' + tag_key.split('_')[-1]],
tag_key.split('_')[1]
)
the_vi... | python | def __get_view_tmpl(tag_key):
'''
根据分类uid的4位编码来找模板。如果4位的存在,则使用4位的;不然找其父类;再不然则使用通用模板
只有View需要,edit, list使用通用模板
:return String.
'''
the_view_file_4 = './templates/tmpl_{0}/tpl_view_{1}.html'.format(
KIND_DICS['kind_' + tag_key.split('_')[-1]],
tag_key.split('_')[1]
)
the_vi... | 根据分类uid的4位编码来找模板。如果4位的存在,则使用4位的;不然找其父类;再不然则使用通用模板
只有View需要,edit, list使用通用模板
:return String. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/script/autocrud/gen_html_file.py#L29-L49 |
bukun/TorCMS | torcms/script/autocrud/gen_html_file.py | __gen_select_filter | def __gen_select_filter(bl_str):
'''
Convert to html.
:return String.
'''
bianliang = HTML_DICS[bl_str]
# bianliang = eval('html_vars.' + bl_str)
html_out = '''<li class="list-group-item">
<div class="row"><div class="col-sm-3">{0}</div><div class="col-sm-9">
<span class="label labe... | python | def __gen_select_filter(bl_str):
'''
Convert to html.
:return String.
'''
bianliang = HTML_DICS[bl_str]
# bianliang = eval('html_vars.' + bl_str)
html_out = '''<li class="list-group-item">
<div class="row"><div class="col-sm-3">{0}</div><div class="col-sm-9">
<span class="label labe... | Convert to html.
:return String. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/script/autocrud/gen_html_file.py#L52-L71 |
bukun/TorCMS | torcms/script/autocrud/gen_html_file.py | generate_html_files | def generate_html_files(*args):
'''
Generate the templates for adding, editing, viewing.
:return: None
'''
_ = args
for tag_key, tag_list in SWITCH_DICS.items():
if tag_key.startswith('dic_') and (not tag_key.endswith('00')):
__write_add_tmpl(tag_key, tag_list)
__... | python | def generate_html_files(*args):
'''
Generate the templates for adding, editing, viewing.
:return: None
'''
_ = args
for tag_key, tag_list in SWITCH_DICS.items():
if tag_key.startswith('dic_') and (not tag_key.endswith('00')):
__write_add_tmpl(tag_key, tag_list)
__... | Generate the templates for adding, editing, viewing.
:return: None | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/script/autocrud/gen_html_file.py#L74-L87 |
bukun/TorCMS | torcms/script/autocrud/gen_html_file.py | __write_edit_tmpl | def __write_edit_tmpl(tag_key, tag_list):
'''
Generate the HTML file for editing.
:param tag_key: key of the tags.
:param tag_list: list of the tags.
:return: None
'''
edit_file = os.path.join(OUT_DIR, 'edit', 'edit_' + tag_key.split('_')[1] + '.html')
edit_widget_arr = []
for sig in... | python | def __write_edit_tmpl(tag_key, tag_list):
'''
Generate the HTML file for editing.
:param tag_key: key of the tags.
:param tag_list: list of the tags.
:return: None
'''
edit_file = os.path.join(OUT_DIR, 'edit', 'edit_' + tag_key.split('_')[1] + '.html')
edit_widget_arr = []
for sig in... | Generate the HTML file for editing.
:param tag_key: key of the tags.
:param tag_list: list of the tags.
:return: None | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/script/autocrud/gen_html_file.py#L90-L130 |
bukun/TorCMS | torcms/script/autocrud/gen_html_file.py | __write_view_tmpl | def __write_view_tmpl(tag_key, tag_list):
'''
Generate the HTML file for viewing.
:param tag_key: key of the tags.
:param tag_list: list of the tags.
:return: None
'''
view_file = os.path.join(OUT_DIR, 'view', 'view_' + tag_key.split('_')[1] + '.html')
view_widget_arr = []
for sig in... | python | def __write_view_tmpl(tag_key, tag_list):
'''
Generate the HTML file for viewing.
:param tag_key: key of the tags.
:param tag_list: list of the tags.
:return: None
'''
view_file = os.path.join(OUT_DIR, 'view', 'view_' + tag_key.split('_')[1] + '.html')
view_widget_arr = []
for sig in... | Generate the HTML file for viewing.
:param tag_key: key of the tags.
:param tag_list: list of the tags.
:return: None | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/script/autocrud/gen_html_file.py#L133-L180 |
bukun/TorCMS | torcms/script/autocrud/gen_html_file.py | __write_add_tmpl | def __write_add_tmpl(tag_key, tag_list):
'''
Generate the HTML file for adding.
:param tag_key: key of the tags.
:param tag_list: list of the tags.
:return: None
'''
add_file = os.path.join(OUT_DIR, 'add', 'add_' + tag_key.split('_')[1] + '.html')
add_widget_arr = []
# var_dic = eval... | python | def __write_add_tmpl(tag_key, tag_list):
'''
Generate the HTML file for adding.
:param tag_key: key of the tags.
:param tag_list: list of the tags.
:return: None
'''
add_file = os.path.join(OUT_DIR, 'add', 'add_' + tag_key.split('_')[1] + '.html')
add_widget_arr = []
# var_dic = eval... | Generate the HTML file for adding.
:param tag_key: key of the tags.
:param tag_list: list of the tags.
:return: None | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/script/autocrud/gen_html_file.py#L183-L224 |
bukun/TorCMS | torcms/script/autocrud/gen_html_file.py | __write_filter_tmpl | def __write_filter_tmpl(html_tpl):
'''
doing for directory.
'''
out_dir = os.path.join(os.getcwd(), CRUD_PATH, 'list')
if os.path.exists(out_dir):
pass
else:
os.mkdir(out_dir)
# for var_name in VAR_NAMES:
for var_name, bl_val in SWITCH_DICS.items():
if var_name.st... | python | def __write_filter_tmpl(html_tpl):
'''
doing for directory.
'''
out_dir = os.path.join(os.getcwd(), CRUD_PATH, 'list')
if os.path.exists(out_dir):
pass
else:
os.mkdir(out_dir)
# for var_name in VAR_NAMES:
for var_name, bl_val in SWITCH_DICS.items():
if var_name.st... | doing for directory. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/script/autocrud/gen_html_file.py#L227-L266 |
bukun/TorCMS | torcms/script/autocrud/gen_html_file.py | __write_list_tmpl | def __write_list_tmpl(html_tpl):
'''
doing for directory.
'''
out_dir = os.path.join(os.getcwd(), CRUD_PATH, 'infolist')
if os.path.exists(out_dir):
pass
else:
os.mkdir(out_dir)
# for var_name in VAR_NAMES:
for var_name, bl_val in SWITCH_DICS.items():
if var_name.... | python | def __write_list_tmpl(html_tpl):
'''
doing for directory.
'''
out_dir = os.path.join(os.getcwd(), CRUD_PATH, 'infolist')
if os.path.exists(out_dir):
pass
else:
os.mkdir(out_dir)
# for var_name in VAR_NAMES:
for var_name, bl_val in SWITCH_DICS.items():
if var_name.... | doing for directory. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/script/autocrud/gen_html_file.py#L269-L312 |
bukun/TorCMS | torcms/handlers/user_info_list_handler.py | UserListHandler.list_app | def list_app(self):
'''
List the apps.
'''
kwd = {
'pager': '',
'title': ''
}
self.render('user/info_list/list_app.html', kwd=kwd,
userinfo=self.userinfo) | python | def list_app(self):
'''
List the apps.
'''
kwd = {
'pager': '',
'title': ''
}
self.render('user/info_list/list_app.html', kwd=kwd,
userinfo=self.userinfo) | List the apps. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/user_info_list_handler.py#L36-L45 |
bukun/TorCMS | torcms/handlers/user_info_list_handler.py | UserListHandler.user_most | def user_most(self):
'''
User most used.
'''
kwd = {
'pager': '',
'title': '',
}
self.render('user/info_list/user_most.html',
kwd=kwd,
user_name=self.get_current_user(),
userinfo=self.user... | python | def user_most(self):
'''
User most used.
'''
kwd = {
'pager': '',
'title': '',
}
self.render('user/info_list/user_most.html',
kwd=kwd,
user_name=self.get_current_user(),
userinfo=self.user... | User most used. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/user_info_list_handler.py#L48-L59 |
bukun/TorCMS | torcms/handlers/user_info_list_handler.py | UserListHandler.user_recent | def user_recent(self):
'''
User used recently.
'''
kwd = {
'pager': '',
'title': ''
}
self.render('user/info_list/user_recent.html',
kwd=kwd,
user_name=self.get_current_user(),
userinfo=se... | python | def user_recent(self):
'''
User used recently.
'''
kwd = {
'pager': '',
'title': ''
}
self.render('user/info_list/user_recent.html',
kwd=kwd,
user_name=self.get_current_user(),
userinfo=se... | User used recently. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/user_info_list_handler.py#L62-L73 |
bukun/TorCMS | torcms/handlers/user_info_list_handler.py | UserListHandler.to_find | def to_find(self):
'''
Todo: the name should be changed.
list the infors.
'''
kwd = {'pager': ''}
self.render('user/info_list/most.html',
topmenu='',
userinfo=self.userinfo,
kwd=kwd) | python | def to_find(self):
'''
Todo: the name should be changed.
list the infors.
'''
kwd = {'pager': ''}
self.render('user/info_list/most.html',
topmenu='',
userinfo=self.userinfo,
kwd=kwd) | Todo: the name should be changed.
list the infors. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/user_info_list_handler.py#L75-L84 |
bukun/TorCMS | torcms/handlers/user_info_list_handler.py | UserListHandler.list_recent | def list_recent(self):
'''
List the recent.
'''
recs = MPost.query_recent(20)
kwd = {
'pager': '',
'title': '',
}
self.render('user/info_list/list.html',
kwd=kwd,
rand_eqs=MPost.query_random(),
... | python | def list_recent(self):
'''
List the recent.
'''
recs = MPost.query_recent(20)
kwd = {
'pager': '',
'title': '',
}
self.render('user/info_list/list.html',
kwd=kwd,
rand_eqs=MPost.query_random(),
... | List the recent. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/user_info_list_handler.py#L86-L99 |
bukun/TorCMS | torcms/handlers/user_info_list_handler.py | UserListHandler.find | def find(self):
'''
find the infors.
'''
keyword = self.get_argument('keyword').strip()
kwd = {
'pager': '',
'title': 'Searching Result',
}
self.render('user/info_list/find_list.html',
userinfo=self.userinfo,
... | python | def find(self):
'''
find the infors.
'''
keyword = self.get_argument('keyword').strip()
kwd = {
'pager': '',
'title': 'Searching Result',
}
self.render('user/info_list/find_list.html',
userinfo=self.userinfo,
... | find the infors. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/user_info_list_handler.py#L101-L114 |
bukun/TorCMS | torcms/handlers/relation_handler.py | RelHandler.add_relation | def add_relation(self, url_arr):
'''
Add relationship.
'''
if MPost.get_by_uid(url_arr[1]):
pass
else:
return False
last_post_id = self.get_secure_cookie('last_post_uid')
if last_post_id:
last_post_id = last_post_id.decode('utf... | python | def add_relation(self, url_arr):
'''
Add relationship.
'''
if MPost.get_by_uid(url_arr[1]):
pass
else:
return False
last_post_id = self.get_secure_cookie('last_post_uid')
if last_post_id:
last_post_id = last_post_id.decode('utf... | Add relationship. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/relation_handler.py#L25-L50 |
bukun/TorCMS | torcms/handlers/reply_handler.py | ReplyHandler.list | def list(self, cur_p=''):
'''
List the replies.
'''
if cur_p == '':
current_page_number = 1
else:
current_page_number = int(cur_p)
current_page_number = 1 if current_page_number < 1 else current_page_number
pager_num = int(MReply.total_nu... | python | def list(self, cur_p=''):
'''
List the replies.
'''
if cur_p == '':
current_page_number = 1
else:
current_page_number = int(cur_p)
current_page_number = 1 if current_page_number < 1 else current_page_number
pager_num = int(MReply.total_nu... | List the replies. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/reply_handler.py#L43-L64 |
bukun/TorCMS | torcms/handlers/reply_handler.py | ReplyHandler.get_by_id | def get_by_id(self, reply_id):
'''
Get the reply by id.
'''
reply = MReply.get_by_uid(reply_id)
logger.info('get_reply: {0}'.format(reply_id))
self.render('misc/reply/show_reply.html',
reply=reply,
username=reply.user_name,
... | python | def get_by_id(self, reply_id):
'''
Get the reply by id.
'''
reply = MReply.get_by_uid(reply_id)
logger.info('get_reply: {0}'.format(reply_id))
self.render('misc/reply/show_reply.html',
reply=reply,
username=reply.user_name,
... | Get the reply by id. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/reply_handler.py#L66-L80 |
bukun/TorCMS | torcms/handlers/reply_handler.py | ReplyHandler.add | def add(self, post_id):
'''
Adding reply to a post.
'''
post_data = self.get_post_data()
post_data['user_name'] = self.userinfo.user_name
post_data['user_id'] = self.userinfo.uid
post_data['post_id'] = post_id
replyid = MReply.create_reply(post_data)
... | python | def add(self, post_id):
'''
Adding reply to a post.
'''
post_data = self.get_post_data()
post_data['user_name'] = self.userinfo.user_name
post_data['user_id'] = self.userinfo.uid
post_data['post_id'] = post_id
replyid = MReply.create_reply(post_data)
... | Adding reply to a post. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/reply_handler.py#L82-L96 |
bukun/TorCMS | torcms/handlers/reply_handler.py | ReplyHandler.zan | def zan(self, id_reply):
'''
先在外部表中更新,然后更新内部表字段的值。
有冗余,但是查看的时候避免了联合查询
'''
logger.info('zan: {0}'.format(id_reply))
MReply2User.create_reply(self.userinfo.uid, id_reply)
cur_count = MReply2User.get_voter_count(id_reply)
if cur_count:
MReply.up... | python | def zan(self, id_reply):
'''
先在外部表中更新,然后更新内部表字段的值。
有冗余,但是查看的时候避免了联合查询
'''
logger.info('zan: {0}'.format(id_reply))
MReply2User.create_reply(self.userinfo.uid, id_reply)
cur_count = MReply2User.get_voter_count(id_reply)
if cur_count:
MReply.up... | 先在外部表中更新,然后更新内部表字段的值。
有冗余,但是查看的时候避免了联合查询 | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/reply_handler.py#L99-L116 |
bukun/TorCMS | torcms/handlers/reply_handler.py | ReplyHandler.delete | def delete(self, del_id):
'''
Delete the id
'''
if MReply2User.delete(del_id):
output = {'del_zan': 1}
else:
output = {'del_zan': 0}
return json.dump(output, self) | python | def delete(self, del_id):
'''
Delete the id
'''
if MReply2User.delete(del_id):
output = {'del_zan': 1}
else:
output = {'del_zan': 0}
return json.dump(output, self) | Delete the id | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/reply_handler.py#L118-L126 |
bukun/TorCMS | torcms/model/catalog_model.py | MCatalog.query_by_slug | def query_by_slug(slug):
'''
查询全部章节
'''
cat_rec = MCategory.get_by_slug(slug)
if cat_rec:
cat_id = cat_rec.uid
else:
return None
if cat_id.endswith('00'):
cat_con = TabPost2Tag.par_id == cat_id
else:
cat_con... | python | def query_by_slug(slug):
'''
查询全部章节
'''
cat_rec = MCategory.get_by_slug(slug)
if cat_rec:
cat_id = cat_rec.uid
else:
return None
if cat_id.endswith('00'):
cat_con = TabPost2Tag.par_id == cat_id
else:
cat_con... | 查询全部章节 | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/catalog_model.py#L23-L47 |
bukun/TorCMS | torcms/model/catalog_model.py | MCatalog.query_all | def query_all():
'''
查询大类记录
'''
recs = TabTag.select().where(TabTag.uid.endswith('00')).order_by(TabTag.uid)
return recs | python | def query_all():
'''
查询大类记录
'''
recs = TabTag.select().where(TabTag.uid.endswith('00')).order_by(TabTag.uid)
return recs | 查询大类记录 | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/catalog_model.py#L50-L56 |
bukun/TorCMS | torcms/handlers/wiki_history_manager.py | WikiHistoryHandler.update | def update(self, uid):
'''
Update the post via ID.
'''
if self.userinfo.role[0] > '0':
pass
else:
return False
post_data = self.get_post_data()
post_data['user_name'] = self.userinfo.user_name if self.userinfo else ''
cur_info = MW... | python | def update(self, uid):
'''
Update the post via ID.
'''
if self.userinfo.role[0] > '0':
pass
else:
return False
post_data = self.get_post_data()
post_data['user_name'] = self.userinfo.user_name if self.userinfo else ''
cur_info = MW... | Update the post via ID. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/wiki_history_manager.py#L26-L43 |
bukun/TorCMS | torcms/handlers/wiki_history_manager.py | WikiHistoryHandler.to_edit | def to_edit(self, postid):
'''
Try to edit the Post.
'''
if self.userinfo.role[0] > '0':
pass
else:
return False
kwd = {}
self.render('man_info/wiki_man_edit.html',
userinfo=self.userinfo,
postinfo=MW... | python | def to_edit(self, postid):
'''
Try to edit the Post.
'''
if self.userinfo.role[0] > '0':
pass
else:
return False
kwd = {}
self.render('man_info/wiki_man_edit.html',
userinfo=self.userinfo,
postinfo=MW... | Try to edit the Post. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/wiki_history_manager.py#L46-L58 |
bukun/TorCMS | torcms/handlers/wiki_history_manager.py | WikiHistoryHandler.delete | def delete(self, uid):
'''
Delete the history of certain ID.
'''
if self.check_post_role()['DELETE']:
pass
else:
return False
histinfo = MWikiHist.get_by_uid(uid)
if histinfo:
pass
else:
return False
... | python | def delete(self, uid):
'''
Delete the history of certain ID.
'''
if self.check_post_role()['DELETE']:
pass
else:
return False
histinfo = MWikiHist.get_by_uid(uid)
if histinfo:
pass
else:
return False
... | Delete the history of certain ID. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/wiki_history_manager.py#L61-L78 |
bukun/TorCMS | torcms/handlers/wiki_history_manager.py | WikiHistoryHandler.restore | def restore(self, hist_uid):
'''
Restore by ID
'''
if self.check_post_role()['ADMIN']:
pass
else:
return False
histinfo = MWikiHist.get_by_uid(hist_uid)
if histinfo:
pass
else:
return False
postinfo ... | python | def restore(self, hist_uid):
'''
Restore by ID
'''
if self.check_post_role()['ADMIN']:
pass
else:
return False
histinfo = MWikiHist.get_by_uid(hist_uid)
if histinfo:
pass
else:
return False
postinfo ... | Restore by ID | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/wiki_history_manager.py#L124-L155 |
bukun/TorCMS | torcms/model/log_model.py | MLog.add | def add(data_dic):
'''
Insert new record.
'''
uid = data_dic['uid']
TabLog.create(
uid=uid,
current_url=data_dic['url'],
refer_url=data_dic['refer'],
user_id=data_dic['user_id'],
time_create=data_dic['timein'],
... | python | def add(data_dic):
'''
Insert new record.
'''
uid = data_dic['uid']
TabLog.create(
uid=uid,
current_url=data_dic['url'],
refer_url=data_dic['refer'],
user_id=data_dic['user_id'],
time_create=data_dic['timein'],
... | Insert new record. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/log_model.py#L20-L35 |
bukun/TorCMS | torcms/model/log_model.py | MLog.query_pager_by_user | def query_pager_by_user(userid, current_page_num=1):
'''
Query pager
'''
return TabLog.select().where(TabLog.user_id == userid).order_by(
TabLog.time_create.desc()
).paginate(
current_page_num, CMS_CFG['list_num']
) | python | def query_pager_by_user(userid, current_page_num=1):
'''
Query pager
'''
return TabLog.select().where(TabLog.user_id == userid).order_by(
TabLog.time_create.desc()
).paginate(
current_page_num, CMS_CFG['list_num']
) | Query pager | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/log_model.py#L38-L46 |
bukun/TorCMS | torcms/model/log_model.py | MLog.query_all_user | def query_all_user():
'''
查询所有登录用户的访问记录
ToDo: ``None`` ?
'''
return TabLog.select().where(TabLog.user_id != 'None').distinct(TabLog.user_id).order_by(
TabLog.user_id
) | python | def query_all_user():
'''
查询所有登录用户的访问记录
ToDo: ``None`` ?
'''
return TabLog.select().where(TabLog.user_id != 'None').distinct(TabLog.user_id).order_by(
TabLog.user_id
) | 查询所有登录用户的访问记录
ToDo: ``None`` ? | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/log_model.py#L49-L56 |
bukun/TorCMS | torcms/model/log_model.py | MLog.query_all | def query_all(current_page_num=1):
'''
查询所有未登录用户的访问记录
ToDo: ``None`` ?
'''
return TabLog.select().where(TabLog.user_id == 'None').order_by(TabLog.time_out.desc()).paginate(
current_page_num, CMS_CFG['list_num']
) | python | def query_all(current_page_num=1):
'''
查询所有未登录用户的访问记录
ToDo: ``None`` ?
'''
return TabLog.select().where(TabLog.user_id == 'None').order_by(TabLog.time_out.desc()).paginate(
current_page_num, CMS_CFG['list_num']
) | 查询所有未登录用户的访问记录
ToDo: ``None`` ? | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/log_model.py#L59-L66 |
bukun/TorCMS | torcms/model/log_model.py | MLog.query_all_pageview | def query_all_pageview(current_page_num=1):
'''
查询所有页面(current_url),分页
'''
return TabLog.select().distinct(TabLog.current_url).order_by(TabLog.current_url).paginate(
current_page_num, CMS_CFG['list_num']
) | python | def query_all_pageview(current_page_num=1):
'''
查询所有页面(current_url),分页
'''
return TabLog.select().distinct(TabLog.current_url).order_by(TabLog.current_url).paginate(
current_page_num, CMS_CFG['list_num']
) | 查询所有页面(current_url),分页 | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/log_model.py#L69-L75 |
bukun/TorCMS | torcms/model/log_model.py | MLog.count_of_current_url | def count_of_current_url(current_url):
'''
长询制订页面(current_url)的访问量
'''
res = TabLog.select().where(TabLog.current_url == current_url)
return res.count() | python | def count_of_current_url(current_url):
'''
长询制订页面(current_url)的访问量
'''
res = TabLog.select().where(TabLog.current_url == current_url)
return res.count() | 长询制订页面(current_url)的访问量 | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/log_model.py#L85-L90 |
bukun/TorCMS | torcms/script/script_check200.py | run_check200 | def run_check200(_):
'''
Running the script.
'''
tstr = ''
idx = 1
for kind in config.router_post.keys():
posts = MPost.query_all(kind=kind, limit=20000)
for post in posts:
the_url0 = '{site_url}/{kind_url}/{uid}'.format(
site_url=config.SITE_CFG['sit... | python | def run_check200(_):
'''
Running the script.
'''
tstr = ''
idx = 1
for kind in config.router_post.keys():
posts = MPost.query_all(kind=kind, limit=20000)
for post in posts:
the_url0 = '{site_url}/{kind_url}/{uid}'.format(
site_url=config.SITE_CFG['sit... | Running the script. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/script/script_check200.py#L29-L60 |
bukun/TorCMS | torcms/model/collect_model.py | MCollect.get_by_signature | def get_by_signature(user_id, app_id):
'''
Get the collection.
'''
try:
return TabCollect.get(
(TabCollect.user_id == user_id) &
(TabCollect.post_id == app_id)
)
except:
return None | python | def get_by_signature(user_id, app_id):
'''
Get the collection.
'''
try:
return TabCollect.get(
(TabCollect.user_id == user_id) &
(TabCollect.post_id == app_id)
)
except:
return None | Get the collection. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/collect_model.py#L42-L52 |
bukun/TorCMS | torcms/model/collect_model.py | MCollect.count_of_user | def count_of_user(user_id):
'''
Get the cound of views.
'''
return TabCollect.select(
TabCollect, TabPost.uid.alias('post_uid'),
TabPost.title.alias('post_title'),
TabPost.view_count.alias('post_view_count')
).where(
TabCollect.user... | python | def count_of_user(user_id):
'''
Get the cound of views.
'''
return TabCollect.select(
TabCollect, TabPost.uid.alias('post_uid'),
TabPost.title.alias('post_title'),
TabPost.view_count.alias('post_view_count')
).where(
TabCollect.user... | Get the cound of views. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/collect_model.py#L55-L67 |
bukun/TorCMS | torcms/model/collect_model.py | MCollect.add_or_update | def add_or_update(user_id, app_id):
'''
Add the collection or update.
'''
rec = MCollect.get_by_signature(user_id, app_id)
if rec:
entry = TabCollect.update(
timestamp=int(time.time())
).where(TabCollect.uid == rec.uid)
entry.... | python | def add_or_update(user_id, app_id):
'''
Add the collection or update.
'''
rec = MCollect.get_by_signature(user_id, app_id)
if rec:
entry = TabCollect.update(
timestamp=int(time.time())
).where(TabCollect.uid == rec.uid)
entry.... | Add the collection or update. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/collect_model.py#L87-L105 |
bukun/TorCMS | torcms/core/libs/deprecation.py | deprecated | def deprecated(deprecated_in=None, removed_in=None, current_version=None, details=""):
"""Decorate a function to signify its deprecation
This function wraps a method that will soon be removed and does two things:
* The docstring of the method will be modified to include a notice
about depreca... | python | def deprecated(deprecated_in=None, removed_in=None, current_version=None, details=""):
"""Decorate a function to signify its deprecation
This function wraps a method that will soon be removed and does two things:
* The docstring of the method will be modified to include a notice
about depreca... | Decorate a function to signify its deprecation
This function wraps a method that will soon be removed and does two things:
* The docstring of the method will be modified to include a notice
about deprecation, e.g., "Deprecated since 0.9.11. Use foo instead."
* Raises a :class:`~deprecatio... | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/core/libs/deprecation.py#L78-L190 |
bukun/TorCMS | torcms/core/libs/deprecation.py | fail_if_not_removed | def fail_if_not_removed(method):
"""Decorate a test method to track removal of deprecated code
This decorator catches :class:`~deprecation.UnsupportedWarning`
warnings that occur during testing and causes unittests to fail,
making it easier to keep track of when code should be removed.
:raises: :c... | python | def fail_if_not_removed(method):
"""Decorate a test method to track removal of deprecated code
This decorator catches :class:`~deprecation.UnsupportedWarning`
warnings that occur during testing and causes unittests to fail,
making it easier to keep track of when code should be removed.
:raises: :c... | Decorate a test method to track removal of deprecated code
This decorator catches :class:`~deprecation.UnsupportedWarning`
warnings that occur during testing and causes unittests to fail,
making it easier to keep track of when code should be removed.
:raises: :class:`AssertionError` if an
... | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/core/libs/deprecation.py#L193-L217 |
bukun/TorCMS | ext_script/script_gen_xlsx_info.py | gen_xlsx_table_info | def gen_xlsx_table_info():
'''
向表中插入数据
'''
XLSX_FILE = './database/esheet/20180811.xlsx'
if os.path.exists(XLSX_FILE):
pass
else:
return
RAW_LIST = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',... | python | def gen_xlsx_table_info():
'''
向表中插入数据
'''
XLSX_FILE = './database/esheet/20180811.xlsx'
if os.path.exists(XLSX_FILE):
pass
else:
return
RAW_LIST = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',... | 向表中插入数据 | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/ext_script/script_gen_xlsx_info.py#L10-L57 |
bukun/TorCMS | torcms/core/base_handler.py | BaseHandler.get_post_data | def get_post_data(self):
'''
Get all the arguments from post request. Only get the first argument by default.
'''
post_data = {}
for key in self.request.arguments:
post_data[key] = self.get_arguments(key)[0]
return post_data | python | def get_post_data(self):
'''
Get all the arguments from post request. Only get the first argument by default.
'''
post_data = {}
for key in self.request.arguments:
post_data[key] = self.get_arguments(key)[0]
return post_data | Get all the arguments from post request. Only get the first argument by default. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/core/base_handler.py#L36-L43 |
bukun/TorCMS | torcms/core/base_handler.py | BaseHandler.check_post_role | def check_post_role(self):
'''
check the user role for docs.
'''
priv_dic = {'ADD': False, 'EDIT': False, 'DELETE': False, 'ADMIN': False}
if self.userinfo:
if self.userinfo.role[1] > '0':
priv_dic['ADD'] = True
if self.userinfo.role[1] >= ... | python | def check_post_role(self):
'''
check the user role for docs.
'''
priv_dic = {'ADD': False, 'EDIT': False, 'DELETE': False, 'ADMIN': False}
if self.userinfo:
if self.userinfo.role[1] > '0':
priv_dic['ADD'] = True
if self.userinfo.role[1] >= ... | check the user role for docs. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/core/base_handler.py#L55-L69 |
bukun/TorCMS | torcms/core/base_handler.py | BaseHandler.get_user_locale | def get_user_locale(self):
'''
Override the function, to control the UI language.
'''
locale_id = self.get_cookie('ulocale')
if locale_id:
return tornado.locale.get(locale_id)
else:
return tornado.locale.get('en_US') | python | def get_user_locale(self):
'''
Override the function, to control the UI language.
'''
locale_id = self.get_cookie('ulocale')
if locale_id:
return tornado.locale.get(locale_id)
else:
return tornado.locale.get('en_US') | Override the function, to control the UI language. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/core/base_handler.py#L80-L88 |
bukun/TorCMS | torcms/core/base_handler.py | BaseHandler.get_browser_locale | def get_browser_locale(self):
'''
Override the function, to control the UI language.
'''
locale_id = self.get_cookie('blocale')
if locale_id:
return tornado.locale.get(locale_id)
else:
return tornado.locale.get('en_US') | python | def get_browser_locale(self):
'''
Override the function, to control the UI language.
'''
locale_id = self.get_cookie('blocale')
if locale_id:
return tornado.locale.get(locale_id)
else:
return tornado.locale.get('en_US') | Override the function, to control the UI language. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/core/base_handler.py#L90-L98 |
bukun/TorCMS | torcms/core/base_handler.py | BaseHandler.wrap_tmpl | def wrap_tmpl(self, tmpl):
'''
return the warpped template path.
:param tmpl:
'''
return 'admin/' + tmpl.format(sig='p') if self.is_p else tmpl.format(sig='') | python | def wrap_tmpl(self, tmpl):
'''
return the warpped template path.
:param tmpl:
'''
return 'admin/' + tmpl.format(sig='p') if self.is_p else tmpl.format(sig='') | return the warpped template path.
:param tmpl: | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/core/base_handler.py#L122-L127 |
bukun/TorCMS | torcms/model/entity_model.py | MEntity.get_id_by_impath | def get_id_by_impath(path):
'''
The the entity id by the path.
'''
logger.info('Get Entiry, Path: {0}'.format(path))
entity_list = TabEntity.select().where(TabEntity.path == path)
out_val = None
if entity_list.count() == 1:
out_val = entity_list.get()... | python | def get_id_by_impath(path):
'''
The the entity id by the path.
'''
logger.info('Get Entiry, Path: {0}'.format(path))
entity_list = TabEntity.select().where(TabEntity.path == path)
out_val = None
if entity_list.count() == 1:
out_val = entity_list.get()... | The the entity id by the path. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/entity_model.py#L48-L64 |
bukun/TorCMS | torcms/model/entity_model.py | MEntity.create_entity | def create_entity(uid='', path='', desc='', kind='1'):
'''
create entity record in the database.
'''
if path:
pass
else:
return False
if uid:
pass
else:
uid = get_uuid()
try:
TabEntity.create(
... | python | def create_entity(uid='', path='', desc='', kind='1'):
'''
create entity record in the database.
'''
if path:
pass
else:
return False
if uid:
pass
else:
uid = get_uuid()
try:
TabEntity.create(
... | create entity record in the database. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/entity_model.py#L67-L91 |
bukun/TorCMS | ext_script/autocrud/gen_html_file.py | generate_html_files | def generate_html_files(*args):
'''
Generate the templates for adding, editing, viewing.
:return: None
'''
_ = args
for tag_key, tag_list in SWITCH_DICS.items():
if tag_key.startswith('dic_'):
__write_view_tmpl(tag_list)
__write_filter_tmpl(TPL_LIST)
__write_list_tm... | python | def generate_html_files(*args):
'''
Generate the templates for adding, editing, viewing.
:return: None
'''
_ = args
for tag_key, tag_list in SWITCH_DICS.items():
if tag_key.startswith('dic_'):
__write_view_tmpl(tag_list)
__write_filter_tmpl(TPL_LIST)
__write_list_tm... | Generate the templates for adding, editing, viewing.
:return: None | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/ext_script/autocrud/gen_html_file.py#L54-L66 |
bukun/TorCMS | torcms/handlers/index.py | IndexHandler.index | def index(self):
'''
Index funtion.
'''
self.render('index/index.html',
userinfo=self.userinfo,
catalog_info=MCategory.query_all(by_order=True),
link=MLink.query_all(),
cfg=CMS_CFG,
view=M... | python | def index(self):
'''
Index funtion.
'''
self.render('index/index.html',
userinfo=self.userinfo,
catalog_info=MCategory.query_all(by_order=True),
link=MLink.query_all(),
cfg=CMS_CFG,
view=M... | Index funtion. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/index.py#L26-L36 |
bukun/TorCMS | torcms/handlers/collect_handler.py | CollectHandler.add_or_update | def add_or_update(self, app_id):
'''
Add or update the category.
'''
logger.info('Collect info: user-{0}, uid-{1}'.format(self.userinfo.uid, app_id))
MCollect.add_or_update(self.userinfo.uid, app_id)
out_dic = {'success': True}
return json.dump(out_dic, self) | python | def add_or_update(self, app_id):
'''
Add or update the category.
'''
logger.info('Collect info: user-{0}, uid-{1}'.format(self.userinfo.uid, app_id))
MCollect.add_or_update(self.userinfo.uid, app_id)
out_dic = {'success': True}
return json.dump(out_dic, self) | Add or update the category. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/collect_handler.py#L44-L51 |
bukun/TorCMS | torcms/handlers/collect_handler.py | CollectHandler.show_list | def show_list(self, the_list, cur_p=''):
'''
List of the user collections.
'''
current_page_num = int(cur_p) if cur_p else 1
current_page_num = 1 if current_page_num < 1 else current_page_num
num_of_cat = MCollect.count_of_user(self.userinfo.uid)
page_num = int(... | python | def show_list(self, the_list, cur_p=''):
'''
List of the user collections.
'''
current_page_num = int(cur_p) if cur_p else 1
current_page_num = 1 if current_page_num < 1 else current_page_num
num_of_cat = MCollect.count_of_user(self.userinfo.uid)
page_num = int(... | List of the user collections. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/collect_handler.py#L54-L76 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.create_wiki | def create_wiki(post_data):
'''
Create the wiki.
'''
logger.info('Call create wiki')
title = post_data['title'].strip()
if len(title) < 2:
logger.info(' ' * 4 + 'The title is too short.')
return False
the_wiki = MWiki.get_by_wiki(title)
... | python | def create_wiki(post_data):
'''
Create the wiki.
'''
logger.info('Call create wiki')
title = post_data['title'].strip()
if len(title) < 2:
logger.info(' ' * 4 + 'The title is too short.')
return False
the_wiki = MWiki.get_by_wiki(title)
... | Create the wiki. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L80-L99 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.create_page | def create_page(slug, post_data):
'''
The page would be created with slug.
'''
logger.info('Call create Page')
if MWiki.get_by_uid(slug):
return False
title = post_data['title'].strip()
if len(title) < 2:
return False
return MWiki.... | python | def create_page(slug, post_data):
'''
The page would be created with slug.
'''
logger.info('Call create Page')
if MWiki.get_by_uid(slug):
return False
title = post_data['title'].strip()
if len(title) < 2:
return False
return MWiki.... | The page would be created with slug. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L102-L113 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.__create_rec | def __create_rec(*args, **kwargs):
'''
Create the record.
'''
uid = args[0]
kind = args[1]
post_data = kwargs['post_data']
try:
TabWiki.create(
uid=uid,
title=post_data['title'].strip(),
date=datetime.da... | python | def __create_rec(*args, **kwargs):
'''
Create the record.
'''
uid = args[0]
kind = args[1]
post_data = kwargs['post_data']
try:
TabWiki.create(
uid=uid,
title=post_data['title'].strip(),
date=datetime.da... | Create the record. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L116-L139 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.query_dated | def query_dated(num=10, kind='1'):
'''
List the wiki of dated.
'''
return TabWiki.select().where(
TabWiki.kind == kind
).order_by(
TabWiki.time_update.desc()
).limit(num) | python | def query_dated(num=10, kind='1'):
'''
List the wiki of dated.
'''
return TabWiki.select().where(
TabWiki.kind == kind
).order_by(
TabWiki.time_update.desc()
).limit(num) | List the wiki of dated. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L142-L150 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.query_most | def query_most(num=8, kind='1'):
'''
List the most viewed wiki.
'''
return TabWiki.select().where(
TabWiki.kind == kind
).order_by(
TabWiki.view_count.desc()
).limit(num) | python | def query_most(num=8, kind='1'):
'''
List the most viewed wiki.
'''
return TabWiki.select().where(
TabWiki.kind == kind
).order_by(
TabWiki.view_count.desc()
).limit(num) | List the most viewed wiki. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L153-L161 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.update_view_count | def update_view_count(citiao):
'''
view count of the wiki, plus 1. By wiki
'''
entry = TabWiki.update(
view_count=TabWiki.view_count + 1
).where(
TabWiki.title == citiao
)
entry.execute() | python | def update_view_count(citiao):
'''
view count of the wiki, plus 1. By wiki
'''
entry = TabWiki.update(
view_count=TabWiki.view_count + 1
).where(
TabWiki.title == citiao
)
entry.execute() | view count of the wiki, plus 1. By wiki | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L164-L173 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.update_view_count_by_uid | def update_view_count_by_uid(uid):
'''
update the count of wiki, by uid.
'''
entry = TabWiki.update(
view_count=TabWiki.view_count + 1
).where(
TabWiki.uid == uid
)
entry.execute() | python | def update_view_count_by_uid(uid):
'''
update the count of wiki, by uid.
'''
entry = TabWiki.update(
view_count=TabWiki.view_count + 1
).where(
TabWiki.uid == uid
)
entry.execute() | update the count of wiki, by uid. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L176-L185 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.get_by_wiki | def get_by_wiki(citiao):
'''
Get the wiki record by title.
'''
q_res = TabWiki.select().where(TabWiki.title == citiao)
the_count = q_res.count()
if the_count == 0 or the_count > 1:
return None
else:
MWiki.update_view_count(citiao)
... | python | def get_by_wiki(citiao):
'''
Get the wiki record by title.
'''
q_res = TabWiki.select().where(TabWiki.title == citiao)
the_count = q_res.count()
if the_count == 0 or the_count > 1:
return None
else:
MWiki.update_view_count(citiao)
... | Get the wiki record by title. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L188-L198 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.view_count_plus | def view_count_plus(slug):
'''
View count plus one.
'''
entry = TabWiki.update(
view_count=TabWiki.view_count + 1,
).where(TabWiki.uid == slug)
entry.execute() | python | def view_count_plus(slug):
'''
View count plus one.
'''
entry = TabWiki.update(
view_count=TabWiki.view_count + 1,
).where(TabWiki.uid == slug)
entry.execute() | View count plus one. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L208-L215 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.query_all | def query_all(**kwargs):
'''
Qeury recent wiki.
'''
kind = kwargs.get('kind', '1')
limit = kwargs.get('limit', 50)
return TabWiki.select().where(TabWiki.kind == kind).limit(limit) | python | def query_all(**kwargs):
'''
Qeury recent wiki.
'''
kind = kwargs.get('kind', '1')
limit = kwargs.get('limit', 50)
return TabWiki.select().where(TabWiki.kind == kind).limit(limit) | Qeury recent wiki. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L218-L225 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.query_random | def query_random(num=6, kind='1'):
'''
Query wikis randomly.
'''
return TabWiki.select().where(
TabWiki.kind == kind
).order_by(
peewee.fn.Random()
).limit(num) | python | def query_random(num=6, kind='1'):
'''
Query wikis randomly.
'''
return TabWiki.select().where(
TabWiki.kind == kind
).order_by(
peewee.fn.Random()
).limit(num) | Query wikis randomly. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L228-L236 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.query_pager_by_kind | def query_pager_by_kind(kind, current_page_num=1):
'''
Query pager
'''
return TabWiki.select().where(TabWiki.kind == kind).order_by(TabWiki.time_create.desc()).paginate(current_page_num, CMS_CFG['list_num']) | python | def query_pager_by_kind(kind, current_page_num=1):
'''
Query pager
'''
return TabWiki.select().where(TabWiki.kind == kind).order_by(TabWiki.time_create.desc()).paginate(current_page_num, CMS_CFG['list_num']) | Query pager | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L254-L258 |
bukun/TorCMS | torcms/model/wiki_model.py | MWiki.count_of_certain_kind | def count_of_certain_kind(kind):
'''
Get the count of certain kind.
'''
recs = TabWiki.select().where(TabWiki.kind == kind)
return recs.count() | python | def count_of_certain_kind(kind):
'''
Get the count of certain kind.
'''
recs = TabWiki.select().where(TabWiki.kind == kind)
return recs.count() | Get the count of certain kind. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/wiki_model.py#L261-L268 |
bukun/TorCMS | torcms/model/label_model.py | MLabel.get_id_by_name | def get_id_by_name(tag_name, kind='z'):
'''
Get ID by tag_name of the label.
'''
recs = TabTag.select().where(
(TabTag.name == tag_name) & (TabTag.kind == kind)
)
logger.info('tag count of {0}: {1} '.format(tag_name, recs.count()))
# the_id = ''
... | python | def get_id_by_name(tag_name, kind='z'):
'''
Get ID by tag_name of the label.
'''
recs = TabTag.select().where(
(TabTag.name == tag_name) & (TabTag.kind == kind)
)
logger.info('tag count of {0}: {1} '.format(tag_name, recs.count()))
# the_id = ''
... | Get ID by tag_name of the label. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/label_model.py#L22-L46 |
bukun/TorCMS | torcms/model/label_model.py | MLabel.get_by_slug | def get_by_slug(tag_slug):
'''
Get label by slug.
'''
label_recs = TabTag.select().where(TabTag.slug == tag_slug)
return label_recs.get() if label_recs else False | python | def get_by_slug(tag_slug):
'''
Get label by slug.
'''
label_recs = TabTag.select().where(TabTag.slug == tag_slug)
return label_recs.get() if label_recs else False | Get label by slug. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/label_model.py#L53-L58 |
bukun/TorCMS | torcms/model/label_model.py | MLabel.create_tag | def create_tag(tag_name, kind='z'):
'''
Create tag record by tag_name
'''
cur_recs = TabTag.select().where(
(TabTag.name == tag_name) &
(TabTag.kind == kind)
)
if cur_recs.count():
uid = cur_recs.get().uid
# TabTag.delete()... | python | def create_tag(tag_name, kind='z'):
'''
Create tag record by tag_name
'''
cur_recs = TabTag.select().where(
(TabTag.name == tag_name) &
(TabTag.kind == kind)
)
if cur_recs.count():
uid = cur_recs.get().uid
# TabTag.delete()... | Create tag record by tag_name | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/label_model.py#L61-L91 |
bukun/TorCMS | torcms/model/label_model.py | MPost2Label.get_by_uid | def get_by_uid(post_id):
'''
Get records by post id.
'''
return TabPost2Tag.select(
TabPost2Tag,
TabTag.name.alias('tag_name'),
TabTag.uid.alias('tag_uid')
).join(
TabTag, on=(TabPost2Tag.tag_id == TabTag.uid)
).where(
... | python | def get_by_uid(post_id):
'''
Get records by post id.
'''
return TabPost2Tag.select(
TabPost2Tag,
TabTag.name.alias('tag_name'),
TabTag.uid.alias('tag_uid')
).join(
TabTag, on=(TabPost2Tag.tag_id == TabTag.uid)
).where(
... | Get records by post id. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/label_model.py#L147-L159 |
bukun/TorCMS | torcms/model/label_model.py | MPost2Label.add_record | def add_record(post_id, tag_name, order=1, kind='z'):
'''
Add the record.
'''
logger.info('Add label kind: {0}'.format(kind))
tag_id = MLabel.get_id_by_name(tag_name, 'z')
labelinfo = MPost2Label.get_by_info(post_id, tag_id)
if labelinfo:
entry = TabPo... | python | def add_record(post_id, tag_name, order=1, kind='z'):
'''
Add the record.
'''
logger.info('Add label kind: {0}'.format(kind))
tag_id = MLabel.get_id_by_name(tag_name, 'z')
labelinfo = MPost2Label.get_by_info(post_id, tag_id)
if labelinfo:
entry = TabPo... | Add the record. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/label_model.py#L190-L209 |
bukun/TorCMS | torcms/model/label_model.py | MPost2Label.total_number | def total_number(slug, kind='1'):
'''
Return the number of certian slug.
'''
return TabPost.select().join(
TabPost2Tag,
on=(TabPost.uid == TabPost2Tag.post_id)
).where(
(TabPost2Tag.tag_id == slug) & (TabPost.kind == kind)
).count() | python | def total_number(slug, kind='1'):
'''
Return the number of certian slug.
'''
return TabPost.select().join(
TabPost2Tag,
on=(TabPost.uid == TabPost2Tag.post_id)
).where(
(TabPost2Tag.tag_id == slug) & (TabPost.kind == kind)
).count() | Return the number of certian slug. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/label_model.py#L212-L221 |
bukun/TorCMS | torcms/model/label_model.py | MPost2Label.query_pager_by_slug | def query_pager_by_slug(slug, kind='1', current_page_num=1):
'''
Query pager
'''
return TabPost.select().join(
TabPost2Tag, on=(TabPost.uid == TabPost2Tag.post_id)
).where(
(TabPost2Tag.tag_id == slug) &
(TabPost.kind == kind)
).paginat... | python | def query_pager_by_slug(slug, kind='1', current_page_num=1):
'''
Query pager
'''
return TabPost.select().join(
TabPost2Tag, on=(TabPost.uid == TabPost2Tag.post_id)
).where(
(TabPost2Tag.tag_id == slug) &
(TabPost.kind == kind)
).paginat... | Query pager | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/label_model.py#L224-L233 |
bukun/TorCMS | torcms/handlers/evaluation_handler.py | EvaluationHandler.add_or_update | def add_or_update(self, app_id, value):
'''
Adding or updating the evalution.
:param app_id: the ID of the post.
:param value: the evaluation
:return: in JSON format.
'''
MEvaluation.add_or_update(self.userinfo.uid, app_id, value)
out_dic = {
... | python | def add_or_update(self, app_id, value):
'''
Adding or updating the evalution.
:param app_id: the ID of the post.
:param value: the evaluation
:return: in JSON format.
'''
MEvaluation.add_or_update(self.userinfo.uid, app_id, value)
out_dic = {
... | Adding or updating the evalution.
:param app_id: the ID of the post.
:param value: the evaluation
:return: in JSON format. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/handlers/evaluation_handler.py#L34-L48 |
bukun/TorCMS | torcms/script/command.py | entry | def entry(argv):
'''
Command entry
'''
command_dic = {
'migrate': run_migrate,
'init': run_init,
'send_nologin': run_send_nologin,
'send_all': run_send_all,
'review': run_review,
'sitemap': run_sitemap,
'editmap': run_editmap,
'check_kind':... | python | def entry(argv):
'''
Command entry
'''
command_dic = {
'migrate': run_migrate,
'init': run_init,
'send_nologin': run_send_nologin,
'send_all': run_send_all,
'review': run_review,
'sitemap': run_sitemap,
'editmap': run_editmap,
'check_kind':... | Command entry | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/script/command.py#L24-L74 |
bukun/TorCMS | torcms/model/entity2user_model.py | MEntity2User.create_entity2user | def create_entity2user(enti_uid, user_id):
'''
create entity2user record in the database.
'''
record = TabEntity2User.select().where(
(TabEntity2User.entity_id == enti_uid) & (TabEntity2User.user_id == user_id)
)
if record.count() > 0:
record = re... | python | def create_entity2user(enti_uid, user_id):
'''
create entity2user record in the database.
'''
record = TabEntity2User.select().where(
(TabEntity2User.entity_id == enti_uid) & (TabEntity2User.user_id == user_id)
)
if record.count() > 0:
record = re... | create entity2user record in the database. | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/model/entity2user_model.py#L66-L84 |
bukun/TorCMS | torcms/script/tmplchecker/__init__.py | check_html | def check_html(html_file, begin):
'''
Checking the HTML
'''
sig = False
for html_line in open(html_file).readlines():
# uu = x.find('{% extends')
uuu = pack_str(html_line).find('%extends')
# print(pack_str(x))
if uuu > 0:
f_tmpl = html_line.strip().split(... | python | def check_html(html_file, begin):
'''
Checking the HTML
'''
sig = False
for html_line in open(html_file).readlines():
# uu = x.find('{% extends')
uuu = pack_str(html_line).find('%extends')
# print(pack_str(x))
if uuu > 0:
f_tmpl = html_line.strip().split(... | Checking the HTML | https://github.com/bukun/TorCMS/blob/6567c7fe2604a1d646d4570c017840958630ed2b/torcms/script/tmplchecker/__init__.py#L39-L94 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.