How to use the vcard.vcard_errors.NOTE_MISSING_PARAMETER function in vcard

To help you get started, we’ve selected a few vcard examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github l0b0 / vcard / tests / test_package.py View on Github external
'message': vcard_errors.NOTE_INVALID_VALUE_COUNT,
    'vcards': ('invalid_value_count_wp.vcf',)}
VCARDS_INVALID_X_NAME = {
    'message': vcard_errors.NOTE_INVALID_X_NAME,
    'vcards': tuple()}
VCARDS_MISMATCH_GROUP = {
    'message': vcard_errors.NOTE_MISMATCH_GROUP,
    'vcards': ('mismatch_group.vcf',)}
VCARDS_MISMATCH_PARAMETER = {
    'message': vcard_errors.NOTE_MISMATCH_PARAMETER,
    'vcards': tuple()}
VCARDS_MISSING_GROUP = {
    'message': vcard_errors.NOTE_MISSING_GROUP,
    'vcards': ('missing_group.vcf',)}
VCARDS_MISSING_PARAMETER = {
    'message': vcard_errors.NOTE_MISSING_PARAMETER,
    'vcards': ('missing_photo_param.vcf',)}
VCARDS_MISSING_PARAM_VALUE = {
    'message': vcard_errors.NOTE_MISSING_PARAM_VALUE,
    'vcards': ('missing_param_value.vcf',)}
VCARDS_MISSING_PROPERTY = {
    'message': vcard_errors.NOTE_MISSING_PROPERTY,
    'vcards': (
        'missing_properties.vcf', 'missing_start.vcf', 'missing_end.vcf', 'missing_version.vcf', 'missing_n.vcf',
        'missing_fn.vcf',)}
VCARDS_MISSING_VALUE_STRING = {
    'message': vcard_errors.NOTE_MISSING_VALUE_STRING,
    'vcards': ('missing_n_value.vcf',)}
VCARDS_NON_EMPTY_PARAMETER = {
    'message': vcard_errors.NOTE_NON_EMPTY_PARAMETER,
    'vcards': (
        'http://aspaass.no/kontakt/Aspaas%20Sykler.vcf',
github l0b0 / vcard / vcard / vcard_validators.py View on Github external
def _expect_parameters(property_):
    if __get_parameters(property_) is None:
        raise VCardItemCountError(NOTE_MISSING_PARAMETER, {})
github l0b0 / vcard / vcard / vcard_validators.py View on Github external
elif property_name in ['PHOTO', 'LOGO']:
            # 
            # 
            _expect_parameters(property_)
            _expect_value_count(property_.values, 1)
            _expect_sub_value_count(property_.values[0], 1)
            for parameter_name, param_values in property_.parameters.items():
                if parameter_name.upper() == 'ENCODING':
                    if param_values != {'b'}:
                        raise VCardValueError('{0}: {1}'.format(NOTE_INVALID_PARAMETER_VALUE, param_values), {})
                    if 'VALUE' in property_.parameters:
                        raise VCardValueError(
                            '{0}: {1} and {2}'.format(NOTE_MISMATCH_PARAMETER, ('ENCODING', 'VALUE')), {})
                elif parameter_name.upper() == 'TYPE' and 'ENCODING' not in property_.parameters:
                    raise VCardItemCountError('{0}: {1}'.format(NOTE_MISSING_PARAMETER, 'ENCODING'), {})
                elif parameter_name.upper() == 'VALUE':
                    if param_values != {'uri'}:
                        raise VCardValueError('{0}: {1}'.format(NOTE_INVALID_PARAMETER_VALUE, param_values), {})
                    else:
                        validate_uri(property_.values[0][0])
                elif parameter_name.upper() not in ['ENCODING', 'TYPE', 'VALUE']:
                    raise VCardNameError('{0}: {1}'.format(NOTE_INVALID_PARAMETER_NAME, parameter_name), {})

        elif property_name == 'BDAY':
            # 
            _expect_no_parameters(property_)
            _expect_value_count(property_.values, 1)
            _expect_sub_value_count(property_.values[0], 1)
            validate_date(property_.values[0][0])

        elif property_name == 'ADR':