allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject git commit: [#7114] Pass in nbhd instead of querying
Date Fri, 31 Jan 2014 05:52:05 GMT
Updated Branches:
  refs/heads/tv/7114 c6b5510a5 -> b91e267d0


[#7114] Pass in nbhd instead of querying

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b91e267d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b91e267d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b91e267d

Branch: refs/heads/tv/7114
Commit: b91e267d07d67cb38a68e389abd67e6e9d712b0b
Parents: c6b5510
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Fri Jan 31 05:51:44 2014 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Fri Jan 31 05:51:44 2014 +0000

----------------------------------------------------------------------
 .../forgetracker/scripts/import_tracker.py      |  9 ++++---
 scripts/allura_import.py                        | 25 ++++++++++++--------
 2 files changed, 19 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b91e267d/ForgeTracker/forgetracker/scripts/import_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/scripts/import_tracker.py b/ForgeTracker/forgetracker/scripts/import_tracker.py
index 965fafa..c991d11 100644
--- a/ForgeTracker/forgetracker/scripts/import_tracker.py
+++ b/ForgeTracker/forgetracker/scripts/import_tracker.py
@@ -27,11 +27,10 @@ log = logging.getLogger(__name__)
 
 
 def import_tracker(cli, project, tool, import_options, doc_txt,
-                   validate=True, verbose=False, cont=False):
-    from allura import model as M
-    p = M.Project.query.get(shortname=project)
-    url = '/rest/{project_url}/{tool}'.format(
-            project_url=p.url().strip('/'),
+        validate=True, verbose=False, cont=False, neighborhood='p'):
+    url = '/rest/{neighborhood}/{project}/{tool}'.format(
+            neighborhood=neighborhood,
+            project=project,
             tool=tool,
             )
     if validate:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b91e267d/scripts/allura_import.py
----------------------------------------------------------------------
diff --git a/scripts/allura_import.py b/scripts/allura_import.py
index 63d14f1..270d988 100644
--- a/scripts/allura_import.py
+++ b/scripts/allura_import.py
@@ -60,20 +60,21 @@ def main():
     if options.tracker:
         import_tracker(
             cli, options.project, options.tracker, import_options, options, doc_txt,
-            validate=options.validate,
-            verbose=options.verbose)
+            validate=options.validate, verbose=options.verbose,
+            neighborhood=options.neighborhood)
     elif options.forum:
-        import_forum(cli, options.project, options.forum,
-                     user_map, doc_txt, validate=options.validate)
+        import_forum(cli, options.project, options.forum, user_map, doc_txt,
+                validate=options.validate, neighborhood=options.neighborhood)
     elif options.wiki:
-        import_wiki(cli, options.project, options.wiki, options, doc_txt)
+        import_wiki(cli, options.project, options.wiki, options, doc_txt,
+                neighborhood=options.neighborhood)
 
 
-def import_forum(cli, project, tool, user_map, doc_txt, validate=True):
-    from allura import model as M
-    p = M.Project.query.get(shortname=project)
-    url = '/rest/{project_url}/{tool}'.format(
-            project_url=p.url().strip('/'),
+def import_forum(cli, project, tool, user_map, doc_txt, validate=True,
+        neighborhood='p'):
+    url = '/rest/{neighborhood}/{project}/{tool}'.format(
+            neighborhood=neighborhood,
+            project=project,
             tool=tool,
             )
     if validate:
@@ -94,6 +95,9 @@ Import project data dump in JSON format into an Allura project.''')
                          dest='secret_key', help='Secret key')
     optparser.add_option('-p', '--project', dest='project',
                          help='Project to import to')
+    optparser.add_option('-n', '--neighborhood', dest='neighborhood',
+                         help="URL prefix of destination neighborhood (default is 'p')",
+                         default='p')
     optparser.add_option('-t', '--tracker', dest='tracker',
                          help='Tracker to import to')
     optparser.add_option('-f', '--forum', dest='forum',
@@ -119,6 +123,7 @@ Import project data dump in JSON format into an Allura project.''')
         optparser.error("Keys are required")
     if not options.project:
         optparser.error("Target project is required")
+    options.neighborhood = options.neighborhood.strip('/')
     return optparser, options, args
 
 


Mime
View raw message