Merge pull request #1165 from imachug/dbquery

DbQuery and Newsfeed bug
This commit is contained in:
ZeroNet 2017-11-04 13:01:05 +01:00 committed by GitHub
commit 8242e91238
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -105,7 +105,7 @@ class UiWebsocketPlugin(object):
for name, query in feeds.iteritems():
try:
db_query = DbQuery(query)
db_query.wheres.append("%s LIKE ? OR %s LIKE ?" % (db_query.fields["body"], db_query.fields["title"]))
db_query.wheres.append("(%s LIKE ? OR %s LIKE ?)" % (db_query.fields["body"], db_query.fields["title"]))
db_query.parts["ORDER BY"] = "date_added DESC"
db_query.parts["LIMIT"] = "30"

View File

@ -22,6 +22,8 @@ class DbQuery:
def parseWheres(self, query_where):
if " AND " in query_where:
return query_where.split(" AND ")
elif query_where:
return [query_where]
else:
return []