• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

修订版85e237ad40ccfbd1987fe2641a1269d5cba3f141 (tree)
时间2011-06-10 23:53:41
作者Dave Brondsema <dbrondsema@geek...>
CommiterDave Brondsema

Log Message

[#2237] query project including nbhd; option to not make Download app; use import_id when loading threads

Signed-off-by: Dave Brondsema <dbrondsema@geek.net>

更改概述

差异

--- a/scripts/teamforge-import.py
+++ b/scripts/teamforge-import.py
@@ -59,6 +59,7 @@ def main():
5959 list_project_ids=False,
6060 neighborhood=None,
6161 neighborhood_shortname=None,
62+ use_thread_import_id_when_reloading=False,
6263 skip_wiki=False,
6364 skip_frs_download=False,
6465 skip_unsupported_check=False)
@@ -291,7 +292,7 @@ def create_project(pid, nbhd):
291292 log.info('Loading: %s %s %s' % (pid, data.data.title, data.data.path))
292293 shortname = convert_project_shortname(data.data.path)
293294
294- project = M.Project.query.get(shortname=shortname)
295+ project = M.Project.query.get(shortname=shortname, neighborhood_id=nbhd._id)
295296 if not project:
296297 private = (data.access_level == 'private')
297298 log.debug('Creating %s private=%s' % (shortname, private))
@@ -347,7 +348,7 @@ def create_project(pid, nbhd):
347348
348349 if not options.skip_wiki and 'wiki' in dirs:
349350 import_wiki(project, pid, nbhd)
350- if not project.app_instance('downloads'):
351+ if not options.skip_frs_download and not project.app_instance('downloads'):
351352 project.install_app('Downloads', 'downloads')
352353 if 'forum' in dirs:
353354 import_discussion(project, pid, frs_mapping, shortname, nbhd)
@@ -437,6 +438,7 @@ def import_discussion(project, pid, frs_mapping, sf_project_shortname, nbhd):
437438 if not discuss_app:
438439 discuss_app = project.install_app('Discussion', 'discussion')
439440 h.set_context(project.shortname, 'discussion', neighborhood=nbhd)
441+ assert c.app
440442 # set permissions and config options
441443 role_admin = M.ProjectRole.by_name('Admin')._id
442444 role_developer = M.ProjectRole.by_name('Developer')._id
@@ -471,15 +473,23 @@ def import_discussion(project, pid, frs_mapping, sf_project_shortname, nbhd):
471473 if '.json' == ending and topic_name in topics:
472474 fo_num_topics += 1
473475 topic_data = loadjson(pid, 'forum', forum_name, topic)
474- to = DM.ForumThread.query.get(
476+ thread_query = dict(
475477 subject=topic_data.title,
476478 discussion_id=fo._id,
477479 app_config_id=discuss_app.config._id)
480+ if not options.skip_thread_import_id_when_reloading:
481+ # temporary/transitional. Just needed the first time
482+ # running with this new code against an existing import
483+ # that didn't have import_ids
484+ thread_query['import_id'] = topic_data.id
485+ to = DM.ForumThread.query.get(**thread_query)
478486 if not to:
479487 to = DM.ForumThread(
480488 subject=topic_data.title,
481489 discussion_id=fo._id,
490+ import_id=topic_data.id,
482491 app_config_id=discuss_app.config._id)
492+ to.import_id=topic_data.id
483493 to_num_replies = 0
484494 oldest_post = None
485495 newest_post = None
@@ -495,6 +505,7 @@ def import_discussion(project, pid, frs_mapping, sf_project_shortname, nbhd):
495505 thread_id=to._id,
496506 discussion_id=fo._id,
497507 app_config_id=discuss_app.config._id)
508+
498509 if not p:
499510 p = DM.ForumPost(
500511 _id='%s%s@import' % (post_name,str(discuss_app.config._id)),
@@ -909,6 +920,10 @@ def get_parser(defaults):
909920 '--n-shortname', dest='neighborhood_shortname',
910921 help='Neighborhood shortname, for PFS extract SQL')
911922 optparser.add_option(
923+ '--skip-thread-import-id-when-reloading', action='store_true',
924+ dest='skip_thread_import_id_when_reloading'
925+ )
926+ optparser.add_option(
912927 '--skip-frs-download', action='store_true', dest='skip_frs_download')
913928 optparser.add_option(
914929 '--skip-wiki', action='store_true', dest='skip_wiki')