コード例 #1
0
    def check_missingvalid(self, data, original_data):
        err_fields = []
        if 'calculation_option' in data:
            if (data['calculation_option']['_val'] == 'Tdb_RH_P'):
                if xisMissing(original_data, 'RH'):
                    err_fields.append('RH')

            if (data['calculation_option']['_val'] == 'Tdb_Twb_P'):
                if xisMissing(original_data, 'Twb'):
                    err_fields.append('Twb')

            if (data['calculation_option']['_val'] == 'Tdb_Tdp_P'):
                if xisMissing(original_data, 'Tdp'):
                    err_fields.append('Tdp')

            if (data['calculation_option']['_val'] == 'Tdb_W_P'):
                if xisMissing(original_data, 'W'):
                    err_fields.append('W')

            if (data['calculation_option']['_val'] == 'Tdb_h_P'):
                if xisMissing(original_data, 'h'):
                    err_fields.append('h')

        if (len(err_fields) > 0):
            raise ValidationError("invalid number", err_fields)
コード例 #2
0
ファイル: schema.py プロジェクト: sandeeprah/clappets
    def check_missingvalid(self, data, original_data):
        err_fields = []
        if 'convert' in data:
            if (data['convert']['_val'] == 'nu2mu'):
                if xisMissing(original_data, 'nu'):
                    err_fields.append('nu')
                if xisMissing(original_data, 'rho'):
                    err_fields.append('rho')
            if (data['convert']['_val'] == 'mu2nu'):
                if xisMissing(original_data, 'mu'):
                    err_fields.append('mu')
                if xisMissing(original_data, 'rho'):
                    err_fields.append('rho')
            if (data['convert']['_val'] == 'nu2ssu'):
                if xisMissing(original_data, 'nu'):
                    err_fields.append('nu')
            if (data['convert']['_val'] == 'ssu2nu'):
                if xisMissing(original_data, 'ssu'):
                    err_fields.append('ssu')
            if (data['convert']['_val'] == 'mu2ssu'):
                if xisMissing(original_data, 'mu'):
                    err_fields.append('mu')
                if xisMissing(original_data, 'rho'):
                    err_fields.append('rho')
            if (data['convert']['_val'] == 'ssu2mu'):
                if xisMissing(original_data, 'ssu'):
                    err_fields.append('ssu')
                if xisMissing(original_data, 'rho'):
                    err_fields.append('rho')

        if (len(err_fields) > 0):
            raise ValidationError("invalid number", err_fields)
コード例 #3
0
ファイル: schema.py プロジェクト: sandeeprah/clappets
    def check_missingvalid(self, data, original_data):
        err_fields = []
        if 'source_option' in data:
            if (data['source_option']['_val'] == 'wall'):
                if xisMissing(original_data, 'width'):
                    err_fields.append('width')
                if xisMissing(original_data, 'height'):
                    err_fields.append('height')

        if (len(err_fields) > 0):
            raise ValidationError("Field is required", err_fields)
コード例 #4
0
    def check_missingvalid(self, data, original_data):
        err_fields = []
        if 'convert' in data:
            if (data['convert']['_val'] == 'cd2lux'):
                if xisMissing(original_data, 'candela'):
                    err_fields.append('candela')
            if (data['convert']['_val'] == 'lux2cd'):
                if xisMissing(original_data, 'lux'):
                    err_fields.append('lux')

        if (len(err_fields) > 0):
            raise ValidationError("invalid number", err_fields)
コード例 #5
0
ファイル: schema.py プロジェクト: sandeeprah/clappets
    def check_missingvalid(self, data, original_data):
        err_fields = []
        if 'convert' in data:
            if (data['convert']['_val'] == 'watts2lumens'):
                if xisMissing(original_data, 'watts'):
                    err_fields.append('watts')
            if (data['convert']['_val'] == 'lumens2watts'):
                if xisMissing(original_data, 'lumens'):
                    err_fields.append('lumens')

        if (len(err_fields) > 0):
            raise ValidationError("invalid number", err_fields)
コード例 #6
0
    def check_missingvalid(self, data, original_data):
        err_fields = []
        if 'viscosity_basis' in data:
            if (data['viscosity_basis']['_val'] == 'kinematic'):
                if xisMissing(original_data, 'nu'):
                    err_fields.append('nu')
            if (data['viscosity_basis']['_val'] == 'dynamic'):
                if xisMissing(original_data, 'mu'):
                    err_fields.append('mu')
                if xisMissing(original_data, 'rho'):
                    err_fields.append('rho')

        if (len(err_fields) > 0):
            raise ValidationError("invalid number", err_fields)
コード例 #7
0
    def check_missing(self, data, original_data):
        err_fields = []
        if 'entry_type' in data:
            if (data['entry_type']['_val'] == 'Rounded'):
                if xisMissing(original_data, 'Rc'):
                    err_fields.append('Rc')
            elif (data['entry_type']['_val'] == 'Angled'):
                if xisMissing(original_data, 'angle'):
                    err_fields.append('angle')
            elif (data['entry_type']['_val'] == 'Projecting'):
                if xisMissing(original_data, 'wall_thickness'):
                    err_fields.append('wall_thickness')

            if (len(err_fields) > 0):
                raise ValidationError("Field is required", err_fields)
コード例 #8
0
ファイル: schema.py プロジェクト: sandeeprah/clappets
    def check_missing(self, data, original_data):
        err_fields = []
        if 'calculation_option' in data:
            if (data['calculation_option']['_val'] == 'NPS'):
                if xisMissing(original_data, 'NPS'):
                    err_fields.append('NPS')
            if (data['calculation_option']['_val'] == 'Di'):
                if xisMissing(original_data, 'Di'):
                    err_fields.append('Di')
            if (data['calculation_option']['_val'] == 'Do'):
                if xisMissing(original_data, 'Do'):
                    err_fields.append('Do')

        if (len(err_fields) > 0):
            raise ValidationError("invalid number", err_fields)
コード例 #9
0
ファイル: schema.py プロジェクト: sandeeprah/clappets
    def check_missing(self, data, original_data):
        err_fields = []
        if 'Kd_basis' in data:
            if (data['Kd_basis']['_val'] == 'Manual'):
                if xisMissing(original_data, 'Kd_manual'):
                    err_fields.append('Kd_manual')

        if 'Kw_basis' in data:
            if (data['Kw_basis']['_val'] == 'Manual'):
                if xisMissing(original_data, 'Kw_manual'):
                    err_fields.append('Kw_manual')

        if 'Kc_basis' in data:
            if (data['Kc_basis']['_val'] == 'Manual'):
                if xisMissing(original_data, 'Kc_manual'):
                    err_fields.append('Kc_manual')

        if (len(err_fields) > 0):
            raise ValidationError("Field is required", err_fields)
コード例 #10
0
    def check_missing(self, data, original_data):
        err_fields = []
        if 'roughness_basis' in data:
            if (data['roughness_basis']['_val'] == 'Material'):
                if xisMissing(original_data, 'material'):
                    err_fields.append('material')
            elif (data['roughness_basis']['_val'] == 'Custom'):
                if xisMissing(original_data, 'roughness'):
                    err_fields.append('roughness')
        if 'size_definition' in data:
            if (data['size_definition']['_val'] == 'NPS'):
                if xisMissing(original_data, 'NPS'):
                    err_fields.append('NPS')
                if xisMissing(original_data, 'schedule'):
                    err_fields.append('schedule')
            elif (data['size_definition']['_val'] == 'Custom'):
                if xisMissing(original_data, 'Dia_inner'):
                    err_fields.append('Dia_inner')

            if (len(err_fields) > 0):
                raise ValidationError("valid input required", err_fields)
コード例 #11
0
    def check_missing(self,data, original_data):
        err_fields = []
        if 'viscosity_basis' in data:
            if (data['viscosity_basis']['_val']=='Dynamic'):
                if xisMissing(original_data, 'mu'):
                    err_fields.append('mu')

            if (data['viscosity_basis']['_val']=='Kinematic'):
                if xisMissing(original_data, 'nu'):
                    err_fields.append('nu')

            if (data['viscosity_basis']['_val']=='SSU'):
                if xisMissing(original_data, 'ssu'):
                    err_fields.append('ssu')

        if 'Kd_basis' in data:
            if (data['Kd_basis']['_val']=='Manual'):
                if xisMissing(original_data, 'Kd_manual'):
                    err_fields.append('Kd_manual')

        if 'Kw_basis' in data:
            if (data['Kw_basis']['_val']=='Manual'):
                if xisMissing(original_data, 'Kw_manual'):
                    err_fields.append('Kw_manual')

        if 'Kc_basis' in data:
            if (data['Kc_basis']['_val']=='Manual'):
                if xisMissing(original_data, 'Kc_manual'):
                    err_fields.append('Kc_manual')


        if (len(err_fields)>0):
            raise ValidationError("Field is required", err_fields)
コード例 #12
0
ファイル: schema.py プロジェクト: sandeeprah/clappets
    def check_missingvalid(self, data, original_data):
        err_fields = []
        if 'state' in data:
            if (data['state']['_val'] == 'Saturated_T'):
                if xisMissing(original_data, 'T'):
                    err_fields.append('T')
                if xisMissing(original_data, 'Q'):
                    err_fields.append('Q')

            if (data['state']['_val'] == 'Saturated_P'):
                if xisMissing(original_data, 'P'):
                    err_fields.append('P')
                if xisMissing(original_data, 'Q'):
                    err_fields.append('Q')

            if (data['state']['_val'] == 'Superheated_or_Compressed'):
                if xisMissing(original_data, 'P'):
                    err_fields.append('P')
                if xisMissing(original_data, 'T'):
                    err_fields.append('T')

        if (len(err_fields) > 0):
            raise ValidationError("Field is required", err_fields)
コード例 #13
0
ファイル: schema.py プロジェクト: sandeeprah/clappets
    def check_missingvalid(self,data, original_data):
        err_fields = []
        if 'calculation_option' in data:
            if (data['calculation_option']['_val']=='calcSPL'):
                if xisMissing(original_data, 'PWL'):
                    err_fields.append('PWL')
                if xisMissing(original_data, 'distance'):
                    err_fields.append('distance')

            if (data['calculation_option']['_val']=='calcPWL'):
                if xisMissing(original_data, 'SPL'):
                    err_fields.append('SPL')
                if xisMissing(original_data, 'distance'):
                    err_fields.append('distance')

            if (data['calculation_option']['_val']=='calcDistance'):
                if xisMissing(original_data, 'PWL'):
                    err_fields.append('PWL')
                if xisMissing(original_data, 'SPL'):
                    err_fields.append('SPL')


        if (len(err_fields)>0):
            raise ValidationError("Field is required", err_fields)
コード例 #14
0
    def check_missingvalid(self, data, original_data):
        err_fields = []
        if 'inlet_definition' in data:
            if (data['inlet_definition']['_val'] == 'P-T'):
                if xisMissing(original_data, 'T_inlet'):
                    err_fields.append('T_inlet')
            if (data['inlet_definition']['_val'] == 'P-h'):
                if xisMissing(original_data, 'h_inlet'):
                    err_fields.append('h_inlet')
            if (data['inlet_definition']['_val'] == 'P-s'):
                if xisMissing(original_data, 's_inlet'):
                    err_fields.append('s_inlet')
            if (data['inlet_definition']['_val'] == 'P-Q'):
                if xisMissing(original_data, 'Q_inlet'):
                    err_fields.append('Q_inlet')

        if 'turbine_definition' in data:
            if (data['turbine_definition']['_val'] == 'mass_flow'):
                if xisMissing(original_data, 'mass_flow'):
                    err_fields.append('mass_flow')
            if (data['turbine_definition']['_val'] == 'power_output'):
                if xisMissing(original_data, 'power_output'):
                    err_fields.append('power_output')

        if 'solve_for' in data:
            if (data['solve_for']['_val'] == 'outlet_properties'):
                if xisMissing(original_data, 'isentropic_efficiency'):
                    err_fields.append('isentropic_efficiency')

            if (data['solve_for']['_val'] == 'isentropic_efficiency'):
                if 'outlet_definition' in data:
                    if (data['outlet_definition']['_val'] == 'P-T'):
                        if xisMissing(original_data, 'T_outlet'):
                            err_fields.append('T_outlet')
                    if (data['outlet_definition']['_val'] == 'P-h'):
                        if xisMissing(original_data, 'h_outlet'):
                            err_fields.append('h_outlet')
                    if (data['outlet_definition']['_val'] == 'P-s'):
                        if xisMissing(original_data, 's_outlet'):
                            err_fields.append('s_outlet')
                    if (data['outlet_definition']['_val'] == 'P-Q'):
                        if xisMissing(original_data, 'Q_outlet'):
                            err_fields.append('Q_outlet')

        if (len(err_fields) > 0):
            raise ValidationError("invalid number", err_fields)