def resolve_redirect(self, name):
"""resolves a redirect and returns the real article name
@param name the name of the redirect
@return the real name of the article or None if it cannot be resolved
"""
try:
self._cursor.execute('SELECT target_article_name FROM redirects WHERE source_article_name=%s;', (name,))
row = self._cursor.fetchone()
if row != None:
return row[0]
except MySQLdb.Error, e:
logging.error('error resolving redirect for name "%s": %s (%d)'
% (name.encode('ascii', 'ignore'), e.args[1], e.args[0]))
return None
评论列表
文章目录