Skip to content

Commit

Permalink
change in writeEntireTemplate2
Browse files Browse the repository at this point in the history
  • Loading branch information
notconfusing committed Oct 8, 2012
1 parent 3268f40 commit c6ff0c6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions viafbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
#if using writeVIAFparamOnly not writeVIAFparamOnly2:
from time import gmtime, strftime #for timestamping


#wikipedia site variables
enwp = wikipedia.getSite('en','wikipedia')
dewp = wikipedia.getSite('de','wikipedia')
#files
wikilinksfile = open("wikilinksforbot2500a10.out")#should be wikilinksforbot.out when real
wikilinksfile = open("wikilinksforbot2500b.out")#should be wikilinksforbot.out when real
wikilinks = wikilinksfile.readlines()
viafbotrun = open("viafbotrun.log", 'w+')
NoDEWPlog = open("NoDEWP.log", 'w+')
Expand Down Expand Up @@ -470,14 +469,18 @@ def writeEntireTemplate2(validatedPage, viafnum):

pageWikiText = validatedPage.get()

replacementText = textlib.replaceExcept(pageWikiText, '{{Persondata' , '{{Authority control|VIAF=' + str(viafnum) + '}}' + '\n' + '{{Persondata', exceptions=[], caseInsensitive=True,
replacementText = textlib.replaceExcept(pageWikiText, '<!-- Metadata: see \[\[Wikipedia:Persondata\]\] -->' , '{{Authority control|VIAF=' + str(viafnum) + '}}' + '\n' + '<!-- Metadata: see [[Wikipedia:Persondata]] -->', exceptions=[], caseInsensitive=True,
allowoverlap=False, marker = '', site = enwp)

if not "Authority control" in replacementText:
replacementText = textlib.replaceExcept(pageWikiText, '{{Persondata' , '{{Authority control|VIAF=' + str(viafnum) + '}}' + '\n' + '{{Persondata', exceptions=[], caseInsensitive=True,
allowoverlap=False, marker = '', site = enwp)

#if we didn't make a change
if not "Authority control" in replacementText:
replacementText = textlib.replaceExcept(pageWikiText, '{{DEFAULTSORT' , '{{Authority control|VIAF=' + str(viafnum) + '}}' + '\n' + '{{DEFAULTSORT', exceptions=[], caseInsensitive=True,
allowoverlap=False, marker = '', site = enwp)

#if we didn't make a change yet
if not "Authority control" in replacementText:
replacementText = textlib.replaceExcept(pageWikiText, '\[\[Category' , '{{Authority control|VIAF=' + str(viafnum) + '}}' +'\n' + '[[Category', exceptions=[], caseInsensitive=True,
Expand Down

0 comments on commit c6ff0c6

Please sign in to comment.