Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
saturn
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
saturn
Commits
310b3a88
Commit
310b3a88
authored
Feb 25, 2019
by
zhanglu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
临时去掉敏感词检测
parent
5abc8c42
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
17 deletions
+34
-17
tag.py
api/views/tag.py
+6
-5
topic.py
api/views/topic.py
+28
-12
No files found.
api/views/tag.py
View file @
310b3a88
...
@@ -13,11 +13,12 @@ class CreateTagForBatch(BaseView):
...
@@ -13,11 +13,12 @@ class CreateTagForBatch(BaseView):
tags
=
[]
tags
=
[]
# 敏感词检测,获取可用的帖子
# 敏感词检测,获取可用的帖子
check_info
=
Sensitive
.
check
([
item
[
"name"
]
for
item
in
tag_list
if
item
.
get
(
"name"
)])
# check_info = Sensitive.check([item["name"] for item in tag_list if item.get("name")])
for
tag
in
tag_list
:
# for tag in tag_list:
succ
=
check_info
.
get
(
tag
.
get
(
"name"
))
if
tag
.
get
(
"name"
)
else
True
# succ = check_info.get(tag.get("name")) if tag.get("name") else True
if
not
succ
:
# if not succ:
tags
.
append
(
tag
)
# tags.append(tag)
tags
=
tag_list
error
,
data
=
self
.
call_rpc
(
'venus/community/tag/batch_create_not_classify'
,
data
=
tags
)
error
,
data
=
self
.
call_rpc
(
'venus/community/tag/batch_create_not_classify'
,
data
=
tags
)
...
...
api/views/topic.py
View file @
310b3a88
...
@@ -30,12 +30,18 @@ class CreateTopicForBatch(BaseView):
...
@@ -30,12 +30,18 @@ class CreateTopicForBatch(BaseView):
topics
=
[]
topics
=
[]
# 敏感词检测,获取可用的帖子
# 敏感词检测,获取可用的帖子
check_info
=
Sensitive
.
check
([
topic
[
"content"
]
for
topic
in
topic_list
if
topic
.
get
(
"content"
)])
# check_info = Sensitive.check([topic["content"] for topic in topic_list if topic.get("content")])
# for topic in topic_list:
# if topic.get('content'):
# succ = check_info.get(topic.get("content"))
# if not succ:
# topics.append(topic)
# else:
# if topic.get('images') or topic.get('video'):
# topics.append(topic)
for
topic
in
topic_list
:
for
topic
in
topic_list
:
if
topic
.
get
(
'content'
):
if
topic
.
get
(
'content'
):
succ
=
check_info
.
get
(
topic
.
get
(
"content"
))
topics
.
append
(
topic
)
if
not
succ
:
topics
.
append
(
topic
)
else
:
else
:
if
topic
.
get
(
'images'
)
or
topic
.
get
(
'video'
):
if
topic
.
get
(
'images'
)
or
topic
.
get
(
'video'
):
topics
.
append
(
topic
)
topics
.
append
(
topic
)
...
@@ -52,8 +58,9 @@ class CreateTopicForBatch(BaseView):
...
@@ -52,8 +58,9 @@ class CreateTopicForBatch(BaseView):
item
[
"tag_id"
]
=
tag_id
item
[
"tag_id"
]
=
tag_id
item
[
"is_online"
]
=
is_online
item
[
"is_online"
]
=
is_online
check_info
=
Sensitive
.
check
(
tag_names
)
# check_info = Sensitive.check(tag_names)
tags
=
[
tag_name
for
tag_name
,
succ
in
check_info
.
items
()
if
not
succ
]
# tags = [tag_name for tag_name, succ in check_info.items() if not succ]
tags
=
tag_names
# 先创建标签
# 先创建标签
_tag_error
,
_tag_data
=
self
.
call_rpc
(
_tag_error
,
_tag_data
=
self
.
call_rpc
(
...
@@ -107,12 +114,19 @@ class CreateTopicForBatchByOne(BaseView):
...
@@ -107,12 +114,19 @@ class CreateTopicForBatchByOne(BaseView):
topics
=
[]
topics
=
[]
# 敏感词检测,获取可用的帖子
# 敏感词检测,获取可用的帖子
check_info
=
Sensitive
.
check
([
topic
[
"content"
]
for
topic
in
topic_list
if
topic
.
get
(
"content"
)])
# check_info = Sensitive.check([topic["content"] for topic in topic_list if topic.get("content")])
# for topic in topic_list:
# if topic.get('content'):
# succ = check_info.get(topic.get("content"))
# if not succ:
# topics.append(topic)
# else:
# if topic.get('images') or topic.get('video'):
# topics.append(topic)
for
topic
in
topic_list
:
for
topic
in
topic_list
:
if
topic
.
get
(
'content'
):
if
topic
.
get
(
'content'
):
succ
=
check_info
.
get
(
topic
.
get
(
"content"
))
topics
.
append
(
topic
)
if
not
succ
:
topics
.
append
(
topic
)
else
:
else
:
if
topic
.
get
(
'images'
)
or
topic
.
get
(
'video'
):
if
topic
.
get
(
'images'
)
or
topic
.
get
(
'video'
):
topics
.
append
(
topic
)
topics
.
append
(
topic
)
...
@@ -128,8 +142,10 @@ class CreateTopicForBatchByOne(BaseView):
...
@@ -128,8 +142,10 @@ class CreateTopicForBatchByOne(BaseView):
item
[
"user_id"
]
=
user_id
item
[
"user_id"
]
=
user_id
need_create_topics
.
append
(
item
)
need_create_topics
.
append
(
item
)
check_info
=
Sensitive
.
check
(
tag_names
)
# check_info = Sensitive.check(tag_names)
tags
=
[
tag_name
for
tag_name
,
succ
in
check_info
.
items
()
if
not
succ
]
# tags = [tag_name for tag_name, succ in check_info.items() if not succ]
# check_info = Sensitive.check(tag_names)
tags
=
tag_names
# 先创建标签
# 先创建标签
_tag_error
,
_tag_data
=
self
.
call_rpc
(
_tag_error
,
_tag_data
=
self
.
call_rpc
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment