Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make GenericObject more amenable to optional fields, clarify docs (bu…

…g 859562)
  • Loading branch information...
commit 9752f2b1f51d7660f68bafa4306d4f40f56ad892 1 parent be53589
@chuckharmston chuckharmston authored
View
7 docs/topics/api/misc.rst
@@ -154,6 +154,13 @@ Feedback
**Request**
+ :param chromeless: (optional) "Yes" or "No", indicating whether the user
+ agent sending the feedback is chromeless.
+ :param feedback: (required) the text of the feedback.
+ :param from_url: (optional) the URL from which the feedback was sent.
+ :param platform: (optional) a description of the platform from which the
+ feedback is being sent.
+
.. code-block:: json
{
View
4 mkt/account/tests/test_api.py
@@ -241,6 +241,10 @@ def test_send_potato(self):
self._test_bad_api_potato_data(tuber_res, tuber_data)
self._test_bad_api_potato_data(potato_res, potato_data)
+ def test_missing_optional_field(self):
+ res, data = self._call(data={'platform': None})
+ eq_(201, res.status_code)
+
def test_send_bad_data(self):
"""
One test to ensure that FeedbackForm is doing its validation duties.
View
5 mkt/api/base.py
@@ -296,7 +296,10 @@ class GenericObject(dict):
subclass.
"""
def __getattr__(self, name):
- return self.__getitem__(name)
+ try:
+ return self.__getitem__(name)
+ except KeyError:
+ return None
def __setattr__(self, name, value):
self.__setitem__(name, value)
Please sign in to comment.
Something went wrong with that request. Please try again.