Repository: allura
Updated Branches:
  refs/heads/master 57d9f1944 -> 247bb35bf


[#8184] Adds icon to project importer


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

Branch: refs/heads/master
Commit: 247bb35bf96e31d9b01d00f15855398e1a4c5d9d
Parents: 57d9f19
Author: Kenton Taylor <ktay...@slashdotmedia.com>
Authored: Mon Feb 12 21:25:48 2018 +0000
Committer: Kenton Taylor <ktay...@slashdotmedia.com>
Committed: Mon Feb 12 21:25:48 2018 +0000

----------------------------------------------------------------------
 scripts/project-import.py | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/247bb35b/scripts/project-import.py
----------------------------------------------------------------------
diff --git a/scripts/project-import.py b/scripts/project-import.py
index 587d091..481b563 100644
--- a/scripts/project-import.py
+++ b/scripts/project-import.py
@@ -178,6 +178,7 @@ class Project(col.MappingSchema):
     trove_natlanguages = TroveTranslations(missing=None)
     trove_environments = TroveUIs(missing=None)
     tool_data = col.SchemaNode(col.Mapping(unknown='preserve'), missing={})
+    icon = col.SchemaNode(col.Str(), missing=None)
     # more fields are added dynamically to the schema in main()
 
 
@@ -276,6 +277,11 @@ def create_project(p, nbhd, options):
                      award_id=a._id,
                      granted_to_project_id=project._id,
                      granted_by_neighborhood_id=nbhd._id)
+
+    if p.icon:
+        with open(p.icon) as icon_file:
+            project.save_icon(p.icon, icon_file)
+
     project.notifications_disabled = False
     with h.push_config(c, project=project, user=p.admin):
         ThreadLocalORMSession.flush_all()

Reply via email to