chg: dev: use list instead filter

This commit is contained in:
rachmadaniHaryono 2021-02-28 13:42:45 +08:00
parent 3ba5d6f93a
commit 4b46293379

View File

@ -173,7 +173,7 @@ def search_bookmarks():
'id': bookmark[0],
'url': bookmark[1],
'title': bookmark[2],
'tags': filter(lambda x: x, bookmark[3].split(',')),
'tags': list(filter(lambda x: x, bookmark[3].split(','))),
'description': bookmark[4]
}
result['bookmarks'].append(result_bookmark)
@ -335,7 +335,7 @@ class ApiBookmarkView(MethodView):
result_bookmark = {
'url': bookmark[1],
'title': bookmark[2],
'tags': filter(lambda x: x, bookmark[3].split(',')),
'tags': list(filter(lambda x: x, bookmark[3].split(','))),
'description': bookmark[4]
}
if not request.path.startswith('/api/'):
@ -349,7 +349,7 @@ class ApiBookmarkView(MethodView):
result = {
'url': bookmark[1],
'title': bookmark[2],
'tags': filter(lambda x: x, bookmark[3].split(',')),
'tags': list(filter(lambda x: x, bookmark[3].split(','))),
'description': bookmark[4]
}
res = jsonify(result)
@ -431,7 +431,7 @@ class ApiBookmarkRangeView(MethodView):
result['bookmarks'][i] = {
'url': bookmark[1],
'title': bookmark[2],
'tags': filter(lambda x: x, bookmark[3].split(',')),
'tags': list(filter(lambda x: x, bookmark[3].split(','))),
'description': bookmark[4]
}
res = jsonify(result)
@ -505,7 +505,7 @@ class ApiBookmarkSearchView(MethodView):
'id': bookmark[0],
'url': bookmark[1],
'title': bookmark[2],
'tags': filter(lambda x: x, bookmark[3].split(',')),
'tags': list(filter(lambda x: x, bookmark[3].split(','))),
'description': bookmark[4]
}
result['bookmarks'].append(result_bookmark)