|
a/scripts/teamforge-import.py |
|
b/scripts/teamforge-import.py |
|
... |
|
... |
282 |
fo = DM.Forum(app_config_id=discuss_app.config._id, shortname=forum_name)
|
282 |
fo = DM.Forum(app_config_id=discuss_app.config._id, shortname=forum_name)
|
283 |
fo.name = forum_data.title
|
283 |
fo.name = forum_data.title
|
284 |
fo.description = forum_data.description
|
284 |
fo.description = forum_data.description
|
285 |
fo_num_topics = 0
|
285 |
fo_num_topics = 0
|
286 |
fo_num_posts = 0
|
286 |
fo_num_posts = 0
|
287 |
|
287 |
|
288 |
topics = os.listdir(os.path.join(options.output_dir, pid, 'forum', forum_name))
|
288 |
topics = os.listdir(os.path.join(options.output_dir, pid, 'forum', forum_name))
|
289 |
for topic in topics:
|
289 |
for topic in topics:
|
290 |
ending = topic[-5:]
|
290 |
ending = topic[-5:]
|
291 |
topic_name = topic[:-5]
|
291 |
topic_name = topic[:-5]
|
292 |
if '.json' == ending and topic_name in topics:
|
292 |
if '.json' == ending and topic_name in topics:
|
|
... |
|
... |
302 |
discussion_id=fo._id,
|
302 |
discussion_id=fo._id,
|
303 |
app_config_id=discuss_app.config._id)
|
303 |
app_config_id=discuss_app.config._id)
|
304 |
to_num_replies = 0
|
304 |
to_num_replies = 0
|
305 |
oldest_post = None
|
305 |
oldest_post = None
|
306 |
newest_post = None
|
306 |
newest_post = None
|
307 |
|
307 |
|
308 |
posts = sorted(os.listdir(os.path.join(options.output_dir, pid, 'forum', forum_name, topic_name)))
|
308 |
posts = sorted(os.listdir(os.path.join(options.output_dir, pid, 'forum', forum_name, topic_name)))
|
309 |
for post in posts:
|
309 |
for post in posts:
|
310 |
ending = post[-5:]
|
310 |
ending = post[-5:]
|
311 |
post_name = post[:-5]
|
311 |
post_name = post[:-5]
|
312 |
if '.json' == ending:
|
312 |
if '.json' == ending:
|
|
... |
|
... |
494 |
|
494 |
|
495 |
def get_news(project):
|
495 |
def get_news(project):
|
496 |
'''
|
496 |
'''
|
497 |
Extracts news posts
|
497 |
Extracts news posts
|
498 |
'''
|
498 |
'''
|
|
|
499 |
global users
|
499 |
app = make_client(options.api_url, 'NewsApp')
|
500 |
app = make_client(options.api_url, 'NewsApp')
|
500 |
|
501 |
|
501 |
# find the forums
|
502 |
# find the forums
|
502 |
posts = app.service.getNewsPostList(s, project.id)
|
503 |
posts = app.service.getNewsPostList(s, project.id)
|
503 |
for post in posts.dataRows:
|
504 |
for post in posts.dataRows:
|
504 |
save(json.dumps(dict(post), default=str), project, 'news', post.id+'.json')
|
505 |
save(json.dumps(dict(post), default=str), project, 'news', post.id+'.json')
|
|
|
506 |
users.add(post.createdByUsername)
|
505 |
|
507 |
|
506 |
def get_discussion(project):
|
508 |
def get_discussion(project):
|
507 |
'''
|
509 |
'''
|
508 |
Extracts discussion forums and posts
|
510 |
Extracts discussion forums and posts
|
509 |
'''
|
511 |
'''
|
|
|
512 |
global users
|
510 |
app = make_client(options.api_url, 'DiscussionApp')
|
513 |
app = make_client(options.api_url, 'DiscussionApp')
|
511 |
|
514 |
|
512 |
# find the forums
|
515 |
# find the forums
|
513 |
forums = app.service.getForumList(s, project.id)
|
516 |
forums = app.service.getForumList(s, project.id)
|
514 |
for forum in forums.dataRows:
|
517 |
for forum in forums.dataRows:
|
|
... |
|
... |
521 |
save(json.dumps(dict(topic), default=str), project, 'forum', forumname, topic.id+'.json')
|
524 |
save(json.dumps(dict(topic), default=str), project, 'forum', forumname, topic.id+'.json')
|
522 |
# posts in this topic
|
525 |
# posts in this topic
|
523 |
posts = app.service.getPostList(s, topic.id)
|
526 |
posts = app.service.getPostList(s, topic.id)
|
524 |
for post in posts.dataRows:
|
527 |
for post in posts.dataRows:
|
525 |
save(json.dumps(dict(post), default=str), project, 'forum', forumname, topic.id, post.id+'.json')
|
528 |
save(json.dumps(dict(post), default=str), project, 'forum', forumname, topic.id, post.id+'.json')
|
526 |
|
529 |
users.add(post.createdByUserName)
|
|
|
530 |
|
527 |
|
531 |
|
528 |
def get_homepage_wiki(project):
|
532 |
def get_homepage_wiki(project):
|
529 |
'''
|
533 |
'''
|
530 |
Extracts home page and wiki pages
|
534 |
Extracts home page and wiki pages
|
531 |
'''
|
535 |
'''
|