377 possible = set(ENTRY_TYPES[values["OBJECTTYPE"]]["require"] + |
377 possible = set(ENTRY_TYPES[values["OBJECTTYPE"]]["require"] + |
378 ENTRY_TYPES[values["OBJECTTYPE"]]["optional"]) |
378 ENTRY_TYPES[values["OBJECTTYPE"]]["optional"]) |
379 required = set(ENTRY_TYPES[values["OBJECTTYPE"]]["require"]) |
379 required = set(ENTRY_TYPES[values["OBJECTTYPE"]]["require"]) |
380 # Verify that parameters defined contains all the parameters required |
380 # Verify that parameters defined contains all the parameters required |
381 if not keys.issuperset(required): |
381 if not keys.issuperset(required): |
382 missing = required.difference(keys)._data.keys() |
382 missing = required.difference(keys) |
383 if len(missing) > 1: |
383 if len(missing) > 1: |
384 attributes = _("Attributes %s are")%_(", ").join(["\"%s\""%attribute for attribute in missing]) |
384 attributes = _("Attributes %s are")%_(", ").join(["\"%s\""%attribute for attribute in missing]) |
385 else: |
385 else: |
386 attributes = _("Attribute \"%s\" is")%missing[0] |
386 attributes = _("Attribute \"%s\" is")%missing.pop() |
387 raise SyntaxError, _("Error on section \"[%s]\":\n%s required for a %s entry")%(section_name, attributes, ENTRY_TYPES[values["OBJECTTYPE"]]["name"]) |
387 raise SyntaxError, _("Error on section \"[%s]\":\n%s required for a %s entry")%(section_name, attributes, ENTRY_TYPES[values["OBJECTTYPE"]]["name"]) |
388 # Verify that parameters defined are all in the possible parameters |
388 # Verify that parameters defined are all in the possible parameters |
389 if not keys.issubset(possible): |
389 if not keys.issubset(possible): |
390 unsupported = keys.difference(possible)._data.keys() |
390 unsupported = keys.difference(possible) |
391 if len(unsupported) > 1: |
391 if len(unsupported) > 1: |
392 attributes = _("Attributes %s are")%_(", ").join(["\"%s\""%attribute for attribute in unsupported]) |
392 attributes = _("Attributes %s are")%_(", ").join(["\"%s\""%attribute for attribute in unsupported]) |
393 else: |
393 else: |
394 attributes = _("Attribute \"%s\" is")%unsupported[0] |
394 attributes = _("Attribute \"%s\" is")%unsupported.pop() |
395 raise SyntaxError, _("Error on section \"[%s]\":\n%s unsupported for a %s entry")%(section_name, attributes, ENTRY_TYPES[values["OBJECTTYPE"]]["name"]) |
395 raise SyntaxError, _("Error on section \"[%s]\":\n%s unsupported for a %s entry")%(section_name, attributes, ENTRY_TYPES[values["OBJECTTYPE"]]["name"]) |
396 |
396 |
397 VerifyValue(values, section_name, "ParameterValue") |
397 VerifyValue(values, section_name, "ParameterValue") |
398 VerifyValue(values, section_name, "DefaultValue") |
398 VerifyValue(values, section_name, "DefaultValue") |
399 |
399 |