#NEWLINE# def full_clean( self ) : #NEWLINE# #INDENT# extra_cleaned_data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# extra_errors = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# required_values = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for field in six . itervalues ( self . fields ) : #NEWLINE# #INDENT# required_values [ field ] = field . required #NEWLINE# #UNINDENT# if self . data : #NEWLINE# #INDENT# hosting_type = self . _get_field_data ( 'hosting_type' ) #NEWLINE# hosting_service = get_hosting_service ( hosting_type ) #NEWLINE# repository_plan = ( self . _get_field_data ( 'repository_plan' ) or self . DEFAULT_PLAN_ID ) #NEWLINE# bug_tracker_use_hosting = self . _get_field_data ( 'bug_tracker_use_hosting' ) #NEWLINE# if bug_tracker_use_hosting : #NEWLINE# #INDENT# bug_tracker_type = hosting_type #NEWLINE# bug_tracker_service = hosting_service #NEWLINE# bug_tracker_plan = repository_plan #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# bug_tracker_type = self . _get_field_data ( 'bug_tracker_type' ) #NEWLINE# bug_tracker_service = get_hosting_service ( bug_tracker_type ) #NEWLINE# bug_tracker_plan = ( self . _get_field_data ( 'bug_tracker_plan' ) or self . DEFAULT_PLAN_ID ) #NEWLINE# #UNINDENT# self . fields [ 'bug_tracker_type' ] . required = ( not bug_tracker_use_hosting ) #NEWLINE# account_pk = self . _get_field_data ( 'hosting_account' ) #NEWLINE# new_hosting_account = ( ( hosting_type != self . NO_HOSTING_SERVICE_ID ) and ( not account_pk ) ) #NEWLINE# if account_pk : #NEWLINE# #INDENT# account = HostingServiceAccount . objects . get ( pk = account_pk , local_site = self . local_site ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# account = None #NEWLINE# #UNINDENT# self . fields [ 'path' ] . required = ( hosting_type == self . NO_HOSTING_SERVICE_ID ) #NEWLINE# for ( service , field ) in ( ( hosting_service , 'repository_plan' ) , ( bug_tracker_service , 'bug_tracker_plan' ) ) : #NEWLINE# #INDENT# self . fields [ field ] . required = ( service and service . plans ) #NEWLINE# if service : #NEWLINE# #INDENT# self . fields [ field ] . choices = [ ( id , info [ 'name' ] ) for ( id , info ) in ( service . plans or [ ] ) ] #NEWLINE# #UNINDENT# #UNINDENT# self . fields [ 'bug_tracker_plan' ] . required = ( self . fields [ 'bug_tracker_plan' ] . required and ( not bug_tracker_use_hosting ) ) #NEWLINE# self . fields [ 'hosting_account' ] . required = False #NEWLINE# self . fields [ 'hosting_account_username' ] . required = new_hosting_account #NEWLINE# self . fields [ 'hosting_account_password' ] . required = ( hosting_service and hosting_service . needs_authorization and ( new_hosting_account or ( account and ( not account . is_authorized ) ) ) ) #NEWLINE# self . fields [ 'hosting_account_two_factor_auth_code' ] . required = ( hosting_service and hosting_service . supports_two_factor_auth and self . hosting_service_info [ hosting_type ] [ 'needs_two_factor_auth_code' ] ) #NEWLINE# self . fields [ 'hosting_url' ] . required = ( hosting_service and hosting_service . self_hosted ) #NEWLINE# self . fields [ 'bug_tracker_hosting_account_username' ] . required = ( ( not bug_tracker_use_hosting ) and bug_tracker_service and bug_tracker_service . get_bug_tracker_requires_username ( bug_tracker_plan ) ) #NEWLINE# self . fields [ 'bug_tracker_hosting_url' ] . required = ( ( not bug_tracker_use_hosting ) and bug_tracker_service and bug_tracker_service . self_hosted ) #NEWLINE# custom_form_info = [ ( hosting_type , repository_plan , self . repository_forms ) ] #NEWLINE# if ( not bug_tracker_use_hosting ) : #NEWLINE# #INDENT# custom_form_info . append ( ( bug_tracker_type , bug_tracker_plan , self . bug_tracker_forms ) ) #NEWLINE# #UNINDENT# for ( service_type , plan , form_list ) in custom_form_info : #NEWLINE# #INDENT# if ( service_type not in self . IGNORED_SERVICE_IDS ) : #NEWLINE# #INDENT# form = form_list [ service_type ] [ plan ] #NEWLINE# form . is_bound = True #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# extra_cleaned_data . update ( form . cleaned_data ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# extra_errors . update ( form . errors ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# for form_list in ( self . repository_forms , self . bug_tracker_forms ) : #NEWLINE# #INDENT# for plans in six . itervalues ( form_list ) : #NEWLINE# #INDENT# for form in six . itervalues ( plans ) : #NEWLINE# #INDENT# if form . is_valid ( ) : #NEWLINE# #INDENT# extra_cleaned_data . update ( form . cleaned_data ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# extra_errors . update ( form . errors ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# self . subforms_valid = ( not extra_errors ) #NEWLINE# super ( RepositoryForm , self ) . full_clean ( ) #NEWLINE# if self . is_valid ( ) : #NEWLINE# #INDENT# self . cleaned_data . update ( extra_cleaned_data ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . errors . update ( extra_errors ) #NEWLINE# #UNINDENT# for ( field , required ) in six . iteritems ( required_values ) : #NEWLINE# #INDENT# field . required = required