Commit cd6f01a7 authored by haowang's avatar haowang

fix code

parent 22cd684b
...@@ -105,7 +105,6 @@ class CreatePictorial(BaseView): ...@@ -105,7 +105,6 @@ class CreatePictorial(BaseView):
topic['user_id'] = self.get_user_id(id_=topic.get('id'), platform=platform) topic['user_id'] = self.get_user_id(id_=topic.get('id'), platform=platform)
error, topic_obj = self.call_rpc('venus/community/crawl/topic', data=topic, platform=platform, pictorial_id=None) error, topic_obj = self.call_rpc('venus/community/crawl/topic', data=topic, platform=platform, pictorial_id=None)
if error: if error:
self.del_cache()
return error, _ return error, _
if not topic_comments: if not topic_comments:
continue continue
...@@ -117,10 +116,8 @@ class CreatePictorial(BaseView): ...@@ -117,10 +116,8 @@ class CreatePictorial(BaseView):
obj.pop('user') obj.pop('user')
error, _ = self.call_rpc('venus/community/crawl/replys', data=topic_comments, platform=platform, topic_id=topic_obj.get('id')) error, _ = self.call_rpc('venus/community/crawl/replys', data=topic_comments, platform=platform, topic_id=topic_obj.get('id'))
if error: if error:
self.del_cache()
return error, _ return error, _
self.del_cache()
return None, None return None, None
def create_pictorial(self, pictorial, platform): def create_pictorial(self, pictorial, platform):
...@@ -151,7 +148,6 @@ class CreatePictorial(BaseView): ...@@ -151,7 +148,6 @@ class CreatePictorial(BaseView):
pictorial['name'] = pictorial.get('content')[:index_end] pictorial['name'] = pictorial.get('content')[:index_end]
error, pictorial_obj = self.call_rpc('venus/community/crawl/pictorial', data=pictorial, platform=platform) error, pictorial_obj = self.call_rpc('venus/community/crawl/pictorial', data=pictorial, platform=platform)
if error: if error:
self.del_cache()
return error, None return error, None
pictorial_id = pictorial_obj.get('id') pictorial_id = pictorial_obj.get('id')
...@@ -160,7 +156,6 @@ class CreatePictorial(BaseView): ...@@ -160,7 +156,6 @@ class CreatePictorial(BaseView):
error, id_ = self.call_rpc('venus/community/crawl/topic', data=obj, platform=platform, pictorial_id=pictorial_id) error, id_ = self.call_rpc('venus/community/crawl/topic', data=obj, platform=platform, pictorial_id=pictorial_id)
if error: if error:
self.del_cache()
return error, None return error, None
if pictorial_comments: if pictorial_comments:
if platform == GRAP_PLATFORM.XIAOHONGSHU: if platform == GRAP_PLATFORM.XIAOHONGSHU:
...@@ -171,10 +166,8 @@ class CreatePictorial(BaseView): ...@@ -171,10 +166,8 @@ class CreatePictorial(BaseView):
error, _ = self.call_rpc('venus/community/crawl/replys', data=pictorial_comments, platform=platform, pictorial_id=pictorial_id) error, _ = self.call_rpc('venus/community/crawl/replys', data=pictorial_comments, platform=platform, pictorial_id=pictorial_id)
if error: if error:
self.del_cache()
return error, None return error, None
self.del_cache()
return None, None return None, None
def post(self, request): def post(self, request):
...@@ -204,10 +197,12 @@ class CreatePictorial(BaseView): ...@@ -204,10 +197,12 @@ class CreatePictorial(BaseView):
for obj in topics: for obj in topics:
error, _ = self.create_pictorial(pictorial=obj, platform=platform) error, _ = self.create_pictorial(pictorial=obj, platform=platform)
if error: if error:
self.del_cache()
return self.error(error=error) return self.error(error=error)
else: else:
error, _ = self.create_topic(topics=topics, platform=platform) error, _ = self.create_topic(topics=topics, platform=platform)
if error: if error:
self.del_cache()
return self.error(error=error) return self.error(error=error)
self.del_cache() self.del_cache()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment