diff scripts/import_sf.py @ 3542:a2fc38fd0142

fixes and speedup
author Richard Jones <richard@users.sourceforge.net>
date Mon, 06 Feb 2006 00:26:13 +0000
parents 07072b1b796c
children 0735c4587852
line wrap: on
line diff
--- a/scripts/import_sf.py	Sun Feb 05 02:41:10 2006 +0000
+++ b/scripts/import_sf.py	Mon Feb 06 00:26:13 2006 +0000
@@ -22,7 +22,11 @@
 '''
 
 import sys, sets, os, csv, time, urllib2, httplib, mimetypes, urlparse
-from elementtree import ElementTree
+
+try:
+    import cElementTree as ElementTree
+except ImportError:
+    from elementtree import ElementTree
 
 from roundup import instance, hyperdb, date, support, password
 
@@ -255,6 +259,7 @@
         for message in artifact.get('messages', []):
             message_id += 1
             authid = users[message['user_name']]
+            if not message['body']: continue
             body = convert_message(message['body'], message_id)
             if not body: continue
             m = {'content': body, 'author': authid,
@@ -281,7 +286,7 @@
         files = []
         for event in artifact.get('history', []):
             if event['field_name'] == 'File Added':
-                fid, name = event['old_value'].split(':')
+                fid, name = event['old_value'].split(':', 1)
                 if fid in add_files:
                     files.append(fid)
                     name = name.strip()

Roundup Issue Tracker: http://roundup-tracker.org/