Permalink
Browse files

Excluded results that use particular templates (Db-meta, Under_constr…

…uction) per user requests.
  • Loading branch information...
MZMcBride
MZMcBride committed Sep 23, 2009
1 parent e8ef37d commit 0b8a0029a4e2cfe7e3f2df6c3f61f2325bdb5d24
Showing with 18 additions and 1 deletion.
  1. +18 −1 userlinksinarticles.py
View
@@ -37,8 +37,23 @@
wiki = wikitools.Wiki(settings.apiurl)
wiki.login(settings.username, settings.password)
skip_pages = []
conn = MySQLdb.connect(host=settings.host, db=settings.dbname, read_default_file='~/.my.cnf')
cursor = conn.cursor()
cursor.execute('''
/* userlinksinarticles.py SLOW_OK */
SELECT
page_title
FROM page
JOIN templatelinks
ON tl_from = page_id
WHERE tl_title IN ('Db-meta', 'Under_construction')
AND tl_namespace = 10
AND page_namespace = 0;
''')
for row in cursor.fetchall():
skip_pages.append(row[0])
cursor.execute('''
/* userlinksinarticles.py SLOW_OK */
SELECT DISTINCT
@@ -58,6 +73,8 @@
output = []
for row in cursor.fetchall():
page_title = u'%s' % unicode(row[0], 'utf-8')
if page_title in skip_pages:
continue
table_row = u'''| %d
| {{plenr|1=%s}}
|-''' % (i, page_title)
@@ -74,4 +91,4 @@
report.edit(report_text, summary=settings.editsumm, bot=1)
cursor.close()
conn.close()
conn.close()

0 comments on commit 0b8a002

Please sign in to comment.