Difference between revisions of "Import Lessons from test wiki"
From COST Action FP0804: FORSYS
SeanGordon (Talk | contribs) m |
SeanGordon (Talk | contribs) |
||
Line 5: | Line 5: | ||
|Has issue description=Some Lessons on the test wiki have been changed since the last import. Need to re-import. | |Has issue description=Some Lessons on the test wiki have been changed since the last import. Need to re-import. | ||
|Has issue solution=1. Delete current Lessons on public wiki | |Has issue solution=1. Delete current Lessons on public wiki | ||
− | * | + | *Problem: For some pages, the page_touched property was ‘False’ |
+ | *I’m not sure why this would be, since creating the page should generate a page_touched date-time | ||
+ | *This caused an error, since the mwclient.page.py script expects all page_touched values (if present) to be a date-time | ||
+ | *I changed a few lines in mwclient.page.py to handle the ‘False’ value correctly | ||
+ | <nowiki> | ||
+ | if info.get('touched'): | ||
+ | touch = info.get('touched') | ||
+ | else: | ||
+ | touch = '0000-00-00T00:00:00Z' | ||
+ | self.touched = client.parse_timestamp(touch) | ||
+ | ##self.touched = client.parse_timestamp(info.get('touched', '0000-00-00T00:00:00Z')) | ||
+ | </nowiki> | ||
2. Re-import lessons from test wiki | 2. Re-import lessons from test wiki | ||
+ | * Done | ||
|Has issue priority=high | |Has issue priority=high | ||
− | |Is issue closed:= | + | |Is issue closed:=Yes |
}} | }} | ||
− | + | <nowiki> | |
import sys | import sys | ||
sys.path.append('mwclient') | sys.path.append('mwclient') |
Revision as of 19:58, 2 May 2013
Has issue type | Suggestion |
---|---|
Has author | Sean |
Has responsible person or organization | Sean (help from Dominique / Jussi) |
Has issue description | Some Lessons on the test wiki have been changed since the last import. Need to re-import. |
Has issue solution | The given value was not understood. |
Has issue priority | "high" is not in the list of possible values (1-high, 2-medium, 3-low) for this property. |
Has task status |
import sys sys.path.append('mwclient') import os import mwclient cat = 'Lesson' ##site = mwclient.Site('test.forsys.siwawa.org','/wiki/') ##site.login('forsys', 'forsys1') site = mwclient.Site('fp0804.emu.ee','/wiki/') site.login('SeanGordon', 'xxx') for pg in site.Categories[cat]: pgname = pg.page_title print pgname pg.delete(reason='Seans automated delete') print "DONE"