Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DictionaryProperty __init__ should take argument which specified the valid types for the value of the dictionary items #588

Open
rpiazza opened this issue Mar 19, 2024 · 0 comments

Comments

@rpiazza
Copy link
Contributor

rpiazza commented Mar 19, 2024

There are normative statements in the spec about the value of dictionary items for properties that are defined to be of the dictionary type (e.g., email-message.additional_header_fields). They are not checked in the clean method.

So far, I have added the valid_types argument to the DictionaryProperty init method which is saved on the specifics member of the class instance.

There are five possible values:

  • None - defaults to 'string'
  • 'string'
  • 'integer'
  • 'string_list'
  • [ string', 'integer']

Things to do:

  • don't allow 'string_list' as one of the values when a list is given for valid_types
  • in clean, check that the value of the dictionary items is the correct type as noted in specifics.
  • some Tests to check for both the correct use of the DictionaryProperty definitions and instantiations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant