Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. def get_value(self, dictionary):
  2. if html.is_html_input(dictionary) and self.field_name in dictionary:
  3. # When HTML form input is used, mark up the input
  4. # as being a JSON string, rather than a JSON primative.
  5. class JSONString(six.text_type):
  6. def __new__(self, value):
  7. ret = six.text_type.__new__(self, value)
  8. ret.is_json_string = True
  9. return ret
  10. return JSONString(dictionary[self.field_name])
  11. return dictionary.get(self.field_name, empty)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement