11 Commits

Author SHA1 Message Date
ae1ee7d6a5 Merge branch 'release-1.0' 2017-11-05 12:28:21 +01:00
93447d8dc6 Prepare release v1.0
Update Copyright Notices
Version information
2017-11-05 12:25:13 +01:00
1b6faf9e53 Use own db for red-task
Since we have several tables and sometimes need to create a copy on
replication servers.
2017-11-05 12:17:05 +01:00
b4c193eedc Disable echoing of SQLAlchemy Egine
We don't need this extensive output for production
2017-11-05 12:07:38 +01:00
788a3df0cd Update jogobot-submodule to v0.1 2017-11-05 12:00:28 +01:00
04f591b466 Merge branch 'fs#161-add-article-titles' into develop 2017-11-05 11:24:15 +01:00
9640467f69 markpages: Use redarticle attribute of Page
Instead of trying to reconstruct our db article title, use the one added
to Page-object by redfam.article_generator

Related Task: [FS#161](https://fs.golderweb.de/index.php?do=details&task_id=161)
2017-11-05 11:22:43 +01:00
bfec2abf98 markpages: Get rid of PageWithTalkPageGenerator
Since redfam.article_generator can yield talkpage with additional
information about redfam and current article from db, we do not need it
anymore.

Related Task: [FS#161](https://fs.golderweb.de/index.php?do=details&task_id=161)
2017-11-05 11:20:55 +01:00
20103d589d redfam: article_generator add redfam info to page
Add reference to redfam object and article title from db to Page object
since Page.title() may differe (short Namespaces, anchors, special chars)

Related Task: [FS#161](https://fs.golderweb.de/index.php?do=details&task_id=161)
2017-11-05 11:18:53 +01:00
e18aa96a84 redfam: article_generator can return talkpage
To make pywikibot.pagegenerators.PageWithTalkPageGenerators unneccessary
so we can manipulate talkpage object directly

Related Task: [FS#161](https://fs.golderweb.de/index.php?do=details&task_id=161)
2017-11-05 11:15:04 +01:00
1dd4c7f87e Merge branch 'test-v7' back into develop 2017-11-02 18:57:59 +01:00
8 changed files with 34 additions and 26 deletions

View File

@@ -18,6 +18,10 @@ Those can be installed using pip and the _requirements.txt_ file provided with t
Versions
--------
* v1.0
- first stable release
- less debug output
- fixed problems with article title
* test-v7
- Fixed problem with url encoded chars in article title

View File

@@ -3,7 +3,7 @@
#
# markpages.py
#
# Copyright 2016 GOLDERWEB Jonathan Golder <jonathan@golderweb.de>
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -145,14 +145,10 @@ class MarkPagesBot( CurrentPageBot ): # sets 'current_page' on each treat()
for redfam in self.redfams:
# We need the talkpage (and only this) of each existing page
for talkpage in pagegenerators.PageWithTalkPageGenerator(
redfam.article_generator(
filter_existing=True,
exclude_article_status=["marked"] ),
return_talk_only=True ):
# Add reference to redfam to talkpages
talkpage.redfam = redfam
for talkpage in redfam.article_generator(
filter_existing=True,
exclude_article_status=["marked"],
talkpages=True ):
yield talkpage
@@ -188,14 +184,8 @@ class MarkPagesBot( CurrentPageBot ): # sets 'current_page' on each treat()
# None if change was not accepted by user
save_ret = self.put_current( self.new_text, summary=summary )
# Normalize title with anchor (replace spaces in anchor)
article = self.current_page.toggleTalkPage().title(
asLink=True, textlink=True)
article = article.strip("[]")
article_parts = article.split("#", 1)
if len(article_parts) == 2:
article_parts[1] = article_parts[1].replace(" ", "_")
article = "#".join(article_parts)
# Get article as named in db
article = self.current_page.redarticle
# Status
if add_ret is None or ( add_ret and save_ret ):

View File

@@ -3,7 +3,7 @@
#
# reddiscparser.py
#
# Copyright 2016 GOLDERWEB Jonathan Golder <jonathan@golderweb.de>
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Submodule jogobot updated: 49ada2993e...d69d873624

View File

@@ -3,7 +3,7 @@
#
# mysqlred.py
#
# Copyright 2015 GOLDERWEB Jonathan Golder <jonathan@golderweb.de>
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -51,10 +51,11 @@ url = URL( "mysql+pymysql",
password=config.db_password,
host=config.db_hostname,
port=config.db_port,
database=config.db_username + jogobot.config['db_suffix'],
database=( config.db_username +
jogobot.config['redundances']['db_suffix'] ),
query={'charset': 'utf8'} )
engine = create_engine(url, echo=True)
engine = create_engine(url, echo=False)
Session = sessionmaker(bind=engine)

View File

@@ -3,7 +3,7 @@
#
# redfam.py
#
# Copyright 2017 GOLDERWEB Jonathan Golder <jonathan@golderweb.de>
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -514,7 +514,8 @@ class RedFamWorker( RedFam ):
def article_generator(self, # noqa
filter_existing=None, filter_redirects=None,
exclude_article_status=[],
onlyinclude_article_status=[] ):
onlyinclude_article_status=[],
talkpages=None ):
"""
Yields pywikibot pageobjects for articles belonging to this redfams
in a generator
@@ -528,6 +529,8 @@ class RedFamWorker( RedFam ):
set to False to get only redirectpages,
unset/None results in not filtering
@type filter_redirects bool/None
@param talkpages Set to True to get Talkpages instead of article page
@type talkpages bool/None
"""
@@ -591,6 +594,16 @@ class RedFamWorker( RedFam ):
except Break:
break
# Toggle talkpage
if talkpages:
page = page.toggleTalkPage()
# Add reference to redfam to pages
page.redfam = self
# Keep article title from db with page object
page.redarticle = article
# Yield filtered pages
yield page

View File

@@ -3,7 +3,7 @@
#
# redpage.py
#
# Copyright 2015 GOLDERWEB Jonathan Golder <jonathan@golderweb.de>
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

2
red.py
View File

@@ -3,7 +3,7 @@
#
# reddiscparser.py
#
# Copyright 2016 GOLDERWEB Jonathan Golder <jonathan@golderweb.de>
# Copyright 2017 Jonathan Golder <jonathan@golderweb.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by