Skip to content

Commit 4f59566

Browse files
author
Richard Jones
committed
fixes and speedup
1 parent 923157f commit 4f59566

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/import_sf.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
'''
2323

2424
import sys, sets, os, csv, time, urllib2, httplib, mimetypes, urlparse
25-
from elementtree import ElementTree
25+
26+
try:
27+
import cElementTree as ElementTree
28+
except ImportError:
29+
from elementtree import ElementTree
2630

2731
from roundup import instance, hyperdb, date, support, password
2832

@@ -255,6 +259,7 @@ def to_date(ts):
255259
for message in artifact.get('messages', []):
256260
message_id += 1
257261
authid = users[message['user_name']]
262+
if not message['body']: continue
258263
body = convert_message(message['body'], message_id)
259264
if not body: continue
260265
m = {'content': body, 'author': authid,
@@ -281,7 +286,7 @@ def to_date(ts):
281286
files = []
282287
for event in artifact.get('history', []):
283288
if event['field_name'] == 'File Added':
284-
fid, name = event['old_value'].split(':')
289+
fid, name = event['old_value'].split(':', 1)
285290
if fid in add_files:
286291
files.append(fid)
287292
name = name.strip()

0 commit comments

Comments
 (0)