changeset 234:e1ce03f9d523

Changed line endings, added ?#format plain. imported from: moin--main--1.5--patch-237
author Alexander Schremmer <alex@alexanderweb.de.tla>
date Thu, 24 Nov 2005 18:10:42 +0000
parents 8c1210a6f9df
children c1e403174a6d
files MoinMoin/scripts/import/importIRCLogs.py
diffstat 1 files changed, 65 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/scripts/import/importIRCLogs.py	Tue Nov 22 21:52:47 2005 +0000
+++ b/MoinMoin/scripts/import/importIRCLogs.py	Thu Nov 24 18:10:42 2005 +0000
@@ -1,65 +1,65 @@
-"""
-MoinMoin - Push files into the wiki.
-
-This script pushes files from a directory into the wiki. It is usable in order
-to mirror IRC logs for example.
-
-    @copyright: 2005 by MoinMoin:AlexanderSchremmer
-    @license: GNU GPL, see COPYING for details.
-"""
-
-### Configuration
-# the request URL, important for farm configurations
-url = "moinmoin.wikiwikiweb.de/"
-
-# the author, visible in RecentChanges etc.
-author = "WikiSyncronisationDaemon"
-
-# the directory that should be pushed
-local_dir = '/home/aschremmer/channel-logging/logs/ChannelLogger/freenode/#moin-dev'
-
-# basepage of the pushed files
-base_page = 'MoinMoinChat/Logs/'
-
-# this function generates a pagename from the file name
-filename_function = lambda filename: '/'.join([x.replace('-', '/') for x in filename.split('.')][:-1])
-### End of configuration
-
-import os, sys
-
-from MoinMoin import wikiutil
-from MoinMoin.request import RequestCLI
-from MoinMoin.PageEditor import PageEditor
-
-def decodeLinewise(text):
-    resultList = []
-
-    for line in text.splitlines():
-        try:
-            decoded_line = line.decode("utf-8")
-        except UnicodeDecodeError:
-            decoded_line = line.decode("iso-8859-1")
-        resultList.append(decoded_line)
-
-    return '\n'.join(resultList)
-
-request = RequestCLI(url=url) #pagename necessary here?
-
-for root, dirs, files in os.walk(local_dir):
-    files.sort()
-    for filename in files[:-1]: # do not push the last file as it is constantly written to
-        pagename = base_page + filename_function(filename)
-        print "Pushing %r as %r" % (filename, pagename)
-        p = PageEditor(request, pagename,
-                       do_editor_backup=0, uid_override=author)
-        if p.exists():
-            continue
-                    
-        fileObj = open(os.path.join(root, filename), 'rb')
-        try:
-            p.saveText(decodeLinewise(fileObj.read()), 0)
-        except PageEditor.SaveError, e:
-            print "Got %r" % (e, )
-        fileObj.close()
-
-print "Finished."
+"""
+MoinMoin - Push files into the wiki.
+
+This script pushes files from a directory into the wiki. It is usable in order
+to mirror IRC logs for example.
+
+    @copyright: 2005 by MoinMoin:AlexanderSchremmer
+    @license: GNU GPL, see COPYING for details.
+"""
+
+### Configuration
+# the request URL, important for farm configurations
+url = "moinmoin.wikiwikiweb.de/"
+
+# the author, visible in RecentChanges etc.
+author = "WikiSyncronisationDaemon"
+
+# the directory that should be pushed
+local_dir = '/home/aschremmer/channel-logging/logs/ChannelLogger/freenode/#moin-dev'
+
+# basepage of the pushed files
+base_page = 'MoinMoinChat/Logs/'
+
+# this function generates a pagename from the file name
+filename_function = lambda filename: '/'.join([x.replace('-', '/') for x in filename.split('.')][:-1])
+### end of configuration
+
+import os, sys
+
+from MoinMoin import wikiutil
+from MoinMoin.request import RequestCLI
+from MoinMoin.PageEditor import PageEditor
+
+def decodeLinewise(text):
+    resultList = []
+
+    for line in text.splitlines():
+        try:
+            decoded_line = line.decode("utf-8")
+        except UnicodeDecodeError:
+            decoded_line = line.decode("iso-8859-1")
+        resultList.append(decoded_line)
+
+    return '\n'.join(resultList)
+
+request = RequestCLI(url=url) #pagename necessary here?
+
+for root, dirs, files in os.walk(local_dir):
+    files.sort()
+    for filename in files[:-1]: # do not push the last file as it is constantly written to
+        pagename = base_page + filename_function(filename)
+        print "Pushing %r as %r" % (filename, pagename)
+        p = PageEditor(request, pagename,
+                       do_editor_backup=0, uid_override=author)
+        if p.exists():
+            continue
+                    
+        fileObj = open(os.path.join(root, filename), 'rb')
+        try:
+            p.saveText("#format plain\n" + decodeLinewise(fileObj.read()), 0)
+        except PageEditor.SaveError, e:
+            print "Got %r" % (e, )
+        fileObj.close()
+
+print "Finished."