Skip to content

Commit 4001bbb

Browse files
author
Richard Jones
committed
*** empty log message ***
1 parent 8b28fab commit 4001bbb

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

scripts/import_sf.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,20 @@
2626

2727
from roundup import instance, hyperdb, date, support, password
2828

29+
today = date.Date('.')
30+
2931
DL_URL = 'http://sourceforge.net/tracker/download.php?group_id=%(group_id)s&atid=%(atid)s&aid=%(aid)s'
3032

3133
def get_url(aid):
3234
""" so basically we have to jump through hoops, given an artifact id, to
3335
figure what the URL should be to access that artifact, and hence any
3436
attached files."""
37+
# first we hit this URL...
3538
conn = httplib.HTTPConnection("sourceforge.net")
3639
conn.request("GET", "/support/tracker.php?aid=%s"%aid)
3740
response = conn.getresponse()
41+
# which should respond with a redirect to the correct url which has the
42+
# magic "group_id" and "atid" values in it that we need
3843
assert response.status == 302, 'response code was %s'%response.status
3944
location = response.getheader('location')
4045
query = urlparse.urlparse(response.getheader('location'))[-2]
@@ -263,6 +268,13 @@ def to_date(ts):
263268
actor = authid
264269
if d['status'] == unread:
265270
d['status'] = chatting
271+
272+
message_id += 1
273+
m = {'content': 'IMPORT FROM SOURCEFORGE', 'author': '1',
274+
'date': today, 'id': str(message_id), 'creation': today }
275+
message_data.append(m)
276+
messages.append(message_id)
277+
266278
d['messages'] = messages
267279
d['nosy'] = list(nosy)
268280

@@ -325,7 +337,6 @@ def convert_message(content, id):
325337
class colon_separated(csv.excel):
326338
delimiter = ':'
327339

328-
today = date.Date('.')
329340
def write_csv(klass, data):
330341
props = klass.getprops()
331342
if not os.path.exists('/tmp/imported'):

0 commit comments

Comments
 (0)