Difference between revisions of "Import Lessons from test wiki"

From COST Action FP0804: FORSYS
Jump to: navigation, search

Warning: require(): Unable to allocate memory for pool. in /data/home/fp0804/www/wiki/includes/AutoLoader.php on line 1191
m (Text replace - "Has issue priority=high" to "Has issue priority=1-high")
 
(4 intermediate revisions by one user not shown)
Line 20: Line 20:
 
2. Re-import lessons from test wiki
 
2. Re-import lessons from test wiki
 
* Done
 
* Done
|Has issue priority=high
+
|Has issue priority=1-high
|Is issue closed:=Yes
+
|Has task status=Completed
 
}}
 
}}
<nowiki>
+
<nowiki>
 
import sys
 
import sys
 
sys.path.append('mwclient')
 
sys.path.append('mwclient')
import os
 
 
import mwclient
 
import mwclient
 +
import time
  
cat = 'Lesson'
+
print __file__ + ' ' + time.asctime( time.localtime(time.time()) )
 +
print 'Transferring...'
  
##site = mwclient.Site('test.forsys.siwawa.org','/wiki/')
+
filter = 'Category:Lesson'
##site.login('forsys', 'forsys1')
+
site = mwclient.Site('fp0804.emu.ee','/wiki/')
+
site.login('SeanGordon', 'xxx')
+
  
for pg in site.Categories[cat]:
+
exclude_lessons = []
     pgname = pg.page_title
+
##exclude_lessons = ['Brazil', 'Actor Network Theory', 'Using GISCAME', 'Assessing forest functions', 'Modular Forest Management']
     print pgname
+
 
     pg.delete(reason='Seans automated delete')
+
site1 = mwclient.Site('test.forsys.siwawa.org','/wiki/')
   
+
site1.login('forsys', 'forsys1')
 +
site2 = mwclient.Site('fp0804.emu.ee','/wiki/')
 +
site2.login('SeanGordon', '4other')
 +
 
 +
for page1 in site1.Pages[filter]:
 +
     pagename = page1.page_title
 +
     print pagename
 +
     text = page1.edit()
 +
    page2 = site2.Pages[pagename]
 +
    page2.save(text,summary='Seans automated transfer')
 +
##    revisions = lessonpage.revisions()
 +
##    for rev in revisions:   
 +
##        print ' comment: ' + rev['comment']
 +
##   
 +
##        if rev['comment'][:4] == 'Sean':
 +
##            print ' - deleting'
 +
##            lessonpage.delete(reason='Seans automated replacement')
 +
##            break
 +
##    print
 
print "DONE"
 
print "DONE"
 
</nowiki>
 
</nowiki>

Latest revision as of 00:22, 7 September 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 1-high
Has task status Completed
import sys
sys.path.append('mwclient')
import mwclient
import time

print __file__ + ' ' + time.asctime( time.localtime(time.time()) )
print 'Transferring...'

filter = 'Category:Lesson'

exclude_lessons = []
##exclude_lessons = ['Brazil', 'Actor Network Theory', 'Using GISCAME', 'Assessing forest functions', 'Modular Forest Management']

site1 = mwclient.Site('test.forsys.siwawa.org','/wiki/')
site1.login('forsys', 'forsys1') 
site2 = mwclient.Site('fp0804.emu.ee','/wiki/')
site2.login('SeanGordon', '4other') 

for page1 in site1.Pages[filter]:
    pagename = page1.page_title
    print pagename
    text = page1.edit()
    page2 = site2.Pages[pagename]
    page2.save(text,summary='Seans automated transfer')
##    revisions = lessonpage.revisions()
##    for rev in revisions:    
##        print ' comment: ' + rev['comment'] 
##    
##        if rev['comment'][:4] == 'Sean':
##            print ' - deleting'
##            lessonpage.delete(reason='Seans automated replacement')
##            break
##    print
print "DONE"