#NEWLINE# def main( dry_run ) : #NEWLINE# #INDENT# n_affected = 0 #NEWLINE# completed_embargoes = models . Embargo . find ( Q ( 'state' , 'eq' , models . Embargo . COMPLETED ) ) #NEWLINE# for embargo in completed_embargoes : #NEWLINE# #INDENT# parent_registration = models . Node . find_one ( Q ( 'embargo' , 'eq' , embargo ) ) #NEWLINE# if len ( parent_registration . nodes ) : #NEWLINE# #INDENT# if any ( ( ( each . is_public is False ) for each in parent_registration . nodes ) ) : #NEWLINE# #INDENT# n_affected += 1 #NEWLINE# logger . info ( 'GUID: {}' . format ( parent_registration . _id ) ) #NEWLINE# logger . info ( 'Contributors: {}' . format ( ', ' . join ( [ each . fullname for each in parent_registration . contributors ] ) ) ) #NEWLINE# for child in parent_registration . nodes : #NEWLINE# #INDENT# if ( not child . is_public ) : #NEWLINE# #INDENT# logger . info ( 'Making child node {} public' . format ( child . _id ) ) #NEWLINE# if ( not dry_run ) : #NEWLINE# #INDENT# with TokuTransaction ( ) : #NEWLINE# #INDENT# child . set_privacy ( 'public' , auth = None , save = True ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# logger . info ( '{} affected registrations' . format ( n_affected ) )