Skip to content

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

@rpiazza

Description

@rpiazza

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions