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