Commit d719c335 authored by Vasyl Bodnaruk's avatar Vasyl Bodnaruk

Add condition to function for update news

parent b319b758
...@@ -33,8 +33,8 @@ class NewsUpdater: ...@@ -33,8 +33,8 @@ class NewsUpdater:
self.db.update(query, data) self.db.update(query, data)
# this bad way # this bad way
def update_all_tags(self): def update_all_tags(self, condition='where 1'):
for i in self.select_news('select id, url from wp_esi_news_accept where 1'): for i in self.select_news('select id, url from wp_esi_news_accept ' + condition):
try: try:
text = self.load_text(i[1]) text = self.load_text(i[1])
tags = self.get_tags(text) tags = self.get_tags(text)
...@@ -43,8 +43,8 @@ class NewsUpdater: ...@@ -43,8 +43,8 @@ class NewsUpdater:
except BaseException as e: except BaseException as e:
print(e.with_traceback()) print(e.with_traceback())
def update_all_text(self): def update_all_text(self, condition='where 1'):
for i in self.select_news('select id, url from wp_esi_news_accept'): for i in self.select_news('select id, url from wp_esi_news_accept ' + condition):
# try: # try:
text = self.load_text(i[1]) text = self.load_text(i[1])
data = (text.encode('ascii', 'ignore'), i[0]) data = (text.encode('ascii', 'ignore'), i[0])
......
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