Skip to content
This repository was archived by the owner on Jan 7, 2021. It is now read-only.

Commit 0bb8ee9

Browse files
committed
Added string validation when an entire new dictionary is added to a document object for #106
1 parent 0f71f0e commit 0bb8ee9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

documentcloud/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,12 @@ def set_data(self, data):
712712
# Validate keywords
713713
for keyword in list(data.keys()):
714714
is_valid_data_keyword(keyword)
715+
# Validate keys and values to verify they are all strings
716+
for key, value in data.items():
717+
if not isinstance(key, six.string_types):
718+
raise TypeError("data attribute keys must be strings")
719+
if not isinstance(value, six.string_types):
720+
raise TypeError("data attribute values must be strings")
715721
# Set the attribute
716722
self.__dict__['data'] = data
717723

0 commit comments

Comments
 (0)