------------------------------------------------------------
revno: 255
committer: Sylvain Beucler <[email protected]>
branch nick: infra
timestamp: Tue 2011-01-11 23:26:51 +0100
message:
  Add wiki backup script
added:
  backup/zwiki-export.py
=== added file 'backup/zwiki-export.py'
--- a/backup/zwiki-export.py    1970-01-01 00:00:00 +0000
+++ b/backup/zwiki-export.py    2011-01-11 22:26:51 +0000
@@ -0,0 +1,30 @@
+import sys
+import pycurl
+try:
+     from cStringIO import StringIO
+except ImportError:
+     from StringIO import StringIO
+
+body = StringIO()
+c = pycurl.Curl()
+c.setopt(c.URL, 'http://savannah.gnu.org/maintenance/FrontPage/pageIds')
+c.setopt(c.WRITEFUNCTION, body.write)
+c.perform()
+c.close()
+
+contents = body.getvalue()
+# TODO: how to easily parse a string as a tuple, without using eval()
+# and opening a security hole big enough for my lazyness to go
+# through?
+list = eval(contents)
+
+for i in list:
+  f = open("zwiki-export/%s" % i, "wb")
+  curl = pycurl.Curl()
+  curl.setopt(pycurl.URL, "http://savannah.gnu.org/maintenance/%s/src"; % i)
+  curl.setopt(pycurl.WRITEDATA, f)
+  curl.perform()
+  curl.close()
+  sys.stdout.write(".")
+  sys.stdout.flush()
+

_______________________________________________
Savannah-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/savannah-cvs

Reply via email to