Skip to content

Commit

Permalink
Fix l0b0#3: Validate 'VERSION' property
Browse files Browse the repository at this point in the history
  • Loading branch information
Zearin committed Jan 26, 2014
1 parent 2cc75a5 commit 576fe06
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions vcard/vcard_validators.py
Expand Up @@ -696,6 +696,23 @@ def validate_vcard_property(prop):
{})
validate_text_value(prop['values'][0][0])

elif property_name == 'VERSION':
if 'parameters' in prop:
raise VCardFormatError(
'{0}: {1[parameters]}'.format(MSG_NON_EMPTY_PARAM, prop),
{})
if len(prop['values']) != 1:
raise VCardFormatError(
'{0}: {1:d} (expected 1)'.format(
MSG_INVALID_VALUE_COUNT,
len(prop['values'])),
{})
if prop['values'][0][0].lower() != '3.0':

This comment has been minimized.

Copy link
@l0b0

l0b0 Jan 27, 2014

What's with the lower()?

raise VCardFormatError(
'{0}: {1} (expected "3.0")'.format(
MSG_INVALID_VALUE,
prop['values'][0][0]),
{})
elif property_name == 'N':
# <http://tools.ietf.org/html/rfc2426#section-3.1.2>
if 'parameters' in prop:
Expand Down

0 comments on commit 576fe06

Please sign in to comment.