diff --git a/scripts/import_sf.py b/scripts/import_sf.py
index c5ab933db89af90478e8aebe13b6f9be70bdc52e..b64b616da0ce0b500124240e85fa28e31ff03fcd 100644 (file)
--- a/scripts/import_sf.py
+++ b/scripts/import_sf.py
-''' Import tracker data from Sourceforge.NET
+""" Import tracker data from Sourceforge.NET
This script needs four steps to work:
roundup-admin -i <tracker home> import /tmp/imported
And you're done!
-'''
+"""
-import sys, sets, os, csv, time, urllib2, httplib, mimetypes, urlparse
+import sys, os, csv, time, urllib2, httplib, mimetypes, urlparse
+# Python 2.3 ... 2.6 compatibility:
+from roundup.anypy.sets_ import set
try:
import cElementTree as ElementTree
def fetch_files(xml_file, file_dir):
""" Fetch files referenced in the xml_file into the dir file_dir. """
root = ElementTree.parse(xml_file).getroot()
- to_fetch = sets.Set()
- deleted = sets.Set()
+ to_fetch = set()
+ deleted = set()
for artifact in root.find('artifacts'):
for field in artifact.findall('field'):
if field.get('name') == 'artifact_id':
deleted.add((aid, fid))
to_fetch = to_fetch - deleted
- got = sets.Set(os.listdir(file_dir))
+ got = set(os.listdir(file_dir))
to_fetch = to_fetch - got
# load cached urls (sigh)
# parse out the XML
artifacts = []
- categories = sets.Set()
- users = sets.Set()
- add_files = sets.Set()
- remove_files = sets.Set()
+ categories = set()
+ users = set()
+ add_files = set()
+ remove_files = set()
for artifact in root.find('artifacts'):
d = {}
op = {}
else:
d['status'] = unread
- nosy = sets.Set()
+ nosy = set()
for message in artifact.get('messages', []):
authid = users[message['user_name']]
if not message['body']: continue
f.close()
def convert_message(content, id):
- ''' Strip off the useless sf message header crap '''
+ """ Strip off the useless sf message header crap """
if content[:14] == 'Logged In: YES':
return '\n'.join(content.splitlines()[3:]).strip()
return content