Skip to content

Commit

Permalink
clean the codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bukun committed Apr 18, 2024
1 parent 7f0e6aa commit 5062157
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions torcms/handlers/post_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import time
from pathlib import Path
import os

# from tornado.template import Loader

# loader = Loader(
Expand Down Expand Up @@ -201,7 +202,6 @@ def get(self, *args, **kwargs):
self.show404()

def post(self, *args, **kwargs):

url_str = args[0]
logger.info('Post url: {0}'.format(url_str))
url_arr = self.parse_url(url_str)
Expand Down Expand Up @@ -273,7 +273,6 @@ def _get_tmpl_view(self, rec):
return tmpl

def __get_cat_id(self, postinfo):

catinfo = MPost2Catalog.get_first_category(postinfo.uid)
if catinfo:
cat_id = catinfo.tag_id
Expand Down Expand Up @@ -506,8 +505,8 @@ def viewinfo(self, postinfo):
# post_type=post_cfg[catinfo.kind].get('show', post_cfg[catinfo.kind].get('router')),
# )

# with open(cache_file, 'wb') as fo:
# fo.write(result)
# with open(cache_file, 'wb') as fo:
# fo.write(result)

# self.render(f'caches/{cache_file.name}')

Expand All @@ -529,7 +528,9 @@ def viewinfo(self, postinfo):
recent_apps=recent_apps,
cat_enum=cat_enum1,
router=post_cfg[catinfo.kind]['router'],
post_type=post_cfg[catinfo.kind].get('show', post_cfg[catinfo.kind].get('router')),
post_type=post_cfg[catinfo.kind].get(
'show', post_cfg[catinfo.kind].get('router')
),
)

def _the_view_kwd(self, postinfo):
Expand Down Expand Up @@ -614,9 +615,9 @@ def __parse_post_data(self):
ext_dic = {}
for key in self.request.arguments:
if (
key.startswith('ext_')
or key.startswith('tag_')
or key.startswith('_tag_')
key.startswith('ext_')
or key.startswith('tag_')
or key.startswith('_tag_')
):
ext_dic[key] = self.get_argument(key, default='')
else:
Expand Down Expand Up @@ -749,7 +750,6 @@ def _delete(self, *args, **kwargs):
current_infor = MPost.get_by_uid(uid)

if MPost.delete(uid):

tslug = MCategory.get_by_uid(current_infor.extinfo['def_cat_uid'])

MCategory.update_count(current_infor.extinfo['def_cat_uid'])
Expand Down Expand Up @@ -848,4 +848,6 @@ def _change_kind(self, post_uid):
# self.update_category(post_uid)

update_category(post_uid, post_data)
self.redirect('/{0}/{1}'.format(post_cfg[post_data['kcat']]['router'], post_uid))
self.redirect(
'/{0}/{1}'.format(post_cfg[post_data['kcat']]['router'], post_uid)
)

0 comments on commit 5062157

Please sign in to comment.