#NEWLINE# def main( env ) : #NEWLINE# #INDENT# INSTITUTIONS = [ ] #NEWLINE# if ( env == 'prod' ) : #NEWLINE# #INDENT# INSTITUTIONS = [ { #NEWLINE# #INDENT# '_id' : 'cos' , #NEWLINE# 'name' : 'Center For Open Science' , #NEWLINE# 'description' : 'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.' , #NEWLINE# 'banner_name' : 'cos-banner.png' , #NEWLINE# 'logo_name' : 'cos-shield.png' , #NEWLINE# 'auth_url' : None , #NEWLINE# 'domains' : [ 'osf.cos.io' ] , #NEWLINE# 'email_domains' : [ 'cos.io' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# '_id' : 'ucr' , #NEWLINE# 'name' : 'University of California Riverside' , #NEWLINE# 'description' : 'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.' , #NEWLINE# 'banner_name' : 'ucr-banner.png' , #NEWLINE# 'logo_name' : 'ucr-shield.png' , #NEWLINE# 'auth_url' : SHIBBOLETH_SP . format ( encode_uri_component ( 'urn:mace:incommon:ucr.edu' ) ) , #NEWLINE# 'domains' : [ 'osf.ucr.edu' ] , #NEWLINE# 'email_domains' : [ ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# '_id' : 'usc' , #NEWLINE# 'name' : 'University of Southern California' , #NEWLINE# 'description' : 'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.' , #NEWLINE# 'banner_name' : 'usc-banner.png' , #NEWLINE# 'logo_name' : 'usc-shield.png' , #NEWLINE# 'auth_url' : SHIBBOLETH_SP . format ( encode_uri_component ( 'urn:mace:incommon:usc.edu' ) ) , #NEWLINE# 'domains' : [ 'osf.usc.edu' ] , #NEWLINE# 'email_domains' : [ ] , #NEWLINE# #UNINDENT# } ] #NEWLINE# #UNINDENT# if ( env == 'stage' ) : #NEWLINE# #INDENT# INSTITUTIONS = [ { #NEWLINE# #INDENT# '_id' : 'cos' , #NEWLINE# 'name' : 'Center For Open Science [Stage]' , #NEWLINE# 'description' : 'Center for Open Science [Stage]' , #NEWLINE# 'banner_name' : 'cos-banner.png' , #NEWLINE# 'logo_name' : 'cos-shield.png' , #NEWLINE# 'auth_url' : None , #NEWLINE# 'domains' : [ 'staging-osf.cos.io' ] , #NEWLINE# 'email_domains' : [ 'cos.io' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# '_id' : 'nd' , #NEWLINE# 'name' : 'University of Notre Dame [Stage]' , #NEWLINE# 'description' : 'University of Notre Dame [Stage]' , #NEWLINE# 'banner_name' : 'nd-banner.png' , #NEWLINE# 'logo_name' : 'nd-shield.png' , #NEWLINE# 'auth_url' : SHIBBOLETH_SP . format ( encode_uri_component ( 'https://login-test.cc.nd.edu/idp/shibboleth' ) ) , #NEWLINE# 'domains' : [ 'staging-osf-nd.cos.io' ] , #NEWLINE# 'email_domains' : [ ] , #NEWLINE# #UNINDENT# } ] #NEWLINE# #UNINDENT# if ( env == 'stage2' ) : #NEWLINE# #INDENT# INSTITUTIONS = [ { #NEWLINE# #INDENT# '_id' : 'cos' , #NEWLINE# 'name' : 'Center For Open Science [Stage2]' , #NEWLINE# 'description' : 'Center for Open Science [Stage2]' , #NEWLINE# 'banner_name' : 'cos-banner.png' , #NEWLINE# 'logo_name' : 'cos-shield.png' , #NEWLINE# 'auth_url' : None , #NEWLINE# 'domains' : [ 'staging2-osf.cos.io' ] , #NEWLINE# 'email_domains' : [ 'cos.io' ] , #NEWLINE# #UNINDENT# } ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( env == 'test' ) : #NEWLINE# #INDENT# INSTITUTIONS = [ { #NEWLINE# #INDENT# '_id' : 'cos' , #NEWLINE# 'name' : 'Center For Open Science [Test]' , #NEWLINE# 'description' : 'Center for Open Science [Test]' , #NEWLINE# 'banner_name' : 'cos-banner.png' , #NEWLINE# 'logo_name' : 'cos-shield.png' , #NEWLINE# 'auth_url' : None , #NEWLINE# 'domains' : [ 'test-osf.cos.io' ] , #NEWLINE# 'email_domains' : [ 'cos.io' ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# '_id' : 'nd' , #NEWLINE# 'name' : 'University of Notre Dame [Test]' , #NEWLINE# 'description' : 'University of Notre Dame [Test]' , #NEWLINE# 'banner_name' : 'nd-banner.png' , #NEWLINE# 'logo_name' : 'nd-shield.png' , #NEWLINE# 'auth_url' : SHIBBOLETH_SP . format ( encode_uri_component ( 'https://login-test.cc.nd.edu/idp/shibboleth' ) ) , #NEWLINE# 'domains' : [ 'test-osf-nd.cos.io' ] , #NEWLINE# 'email_domains' : [ ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# '_id' : 'ucr' , #NEWLINE# 'name' : 'University of California Riverside [Test]' , #NEWLINE# 'description' : 'University of California Riverside [Test]' , #NEWLINE# 'banner_name' : 'ucr-banner.png' , #NEWLINE# 'logo_name' : 'ucr-shield.png' , #NEWLINE# 'auth_url' : SHIBBOLETH_SP . format ( encode_uri_component ( 'urn:mace:incommon:ucr.edu' ) ) , #NEWLINE# 'domains' : [ 'test-osf-ucr.cos.io' ] , #NEWLINE# 'email_domains' : [ ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# '_id' : 'usc' , #NEWLINE# 'name' : 'University of Southern California [Test]' , #NEWLINE# 'description' : 'University of Southern California [Test]' , #NEWLINE# 'banner_name' : 'usc-banner.png' , #NEWLINE# 'logo_name' : 'usc-shield.png' , #NEWLINE# 'auth_url' : SHIBBOLETH_SP . format ( encode_uri_component ( 'urn:mace:incommon:usc.edu' ) ) , #NEWLINE# 'domains' : [ 'test-osf-usc.cos.io' ] , #NEWLINE# 'email_domains' : [ ] , #NEWLINE# #UNINDENT# } ] #NEWLINE# #UNINDENT# #UNINDENT# init_app ( routes = False ) #NEWLINE# with TokuTransaction ( ) : #NEWLINE# #INDENT# for inst_data in INSTITUTIONS : #NEWLINE# #INDENT# ( new_inst , inst_created ) = update_or_create ( inst_data ) #NEWLINE# if ( not inst_created ) : #NEWLINE# #INDENT# nodes = Node . find_by_institution ( new_inst , query = Q ( 'is_deleted' , 'ne' , True ) ) #NEWLINE# for node in nodes : #NEWLINE# #INDENT# update_node ( node , async = False ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for extra_inst in Institution . find ( Q ( '_id' , 'nin' , [ x [ '_id' ] for x in INSTITUTIONS ] ) ) : #NEWLINE# #INDENT# logger . warn ( 'Extra Institution : {} - {}' . format ( extra_inst . _id , extra_inst . name ) )