@@ -306,8 +306,13 @@ def remove_user(email):
306306 default = "https://github.com/GSA/datagov-harvester/refs/heads/main/app/static/assets/img/placeholder-organization.png" ,
307307 help = "Org Logo" ,
308308)
309+ @click .option (
310+ "--aliases" ,
311+ default = "" ,
312+ help = "Comma-separated list of organization aliases" ,
313+ )
309314@click .option ("--id" , help = "Org ID: should correspond to CKAN ORG ID" )
310- def cli_add_org (name , slug , logo , id ):
315+ def cli_add_org (name , slug , logo , id , aliases ):
311316 # let the web UI handle the validation, mostly for slug uniqueness
312317 form_data = MultiDict (
313318 {
@@ -316,6 +321,7 @@ def cli_add_org(name, slug, logo, id):
316321 "logo" : logo ,
317322 "description" : "" ,
318323 "organization_type" : "" ,
324+ "aliases" : aliases ,
319325 }
320326 )
321327
@@ -327,13 +333,7 @@ def cli_add_org(name, slug, logo, id):
327333 click .echo (f" - { field } : { error } " )
328334 return
329335
330- org_contract = {
331- "name" : form .name .data ,
332- "slug" : form .slug .data or None ,
333- "logo" : form .logo .data ,
334- "description" : form .description .data or None ,
335- "organization_type" : form .organization_type .data or None ,
336- }
336+ org_contract = make_new_org_contract (form )
337337 if id :
338338 org_contract ["id" ] = id
339339
@@ -480,6 +480,7 @@ def make_new_org_contract(form):
480480 "logo" : form .logo .data ,
481481 "description" : form .description .data or None ,
482482 "organization_type" : form .organization_type .data or None ,
483+ "aliases" : [alias .strip () for alias in (form .aliases .data or "" ).split ("," )],
483484 }
484485
485486
@@ -505,13 +506,7 @@ def add_organization():
505506 else :
506507 form = OrganizationForm (db_interface = db )
507508 if form .validate_on_submit ():
508- new_org = {
509- "name" : form .name .data ,
510- "slug" : form .slug .data ,
511- "logo" : form .logo .data ,
512- "description" : form .description .data or None ,
513- "organization_type" : form .organization_type .data or None ,
514- }
509+ new_org = make_new_org_contract (form )
515510 org = db .add_organization (new_org )
516511 if org :
517512 flash (f"Added new organization with ID: { org .id } " )
0 commit comments