)]}'
{"zun/api/controllers/base.py":[{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"7b937046c1078f42d1c34d36037c72ff489bc495","unresolved":false,"context_lines":[{"line_number":12,"context_line":"#    License for the specific language governing permissions and limitations"},{"line_number":13,"context_line":"#    under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"from zun.api.utils import check_if_mandatory"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"class APIBase(object):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a71b18c_b9798c95","line":15,"updated":"2016-12-12 10:42:45.000000000","message":"Any reason why you would want this check_if_mandatory method to be in the utils package instead of this base class itself?\n\nIt kinda sounds like a rudimentary import otherwise.","commit_id":"7a7e9dbcccd8b21b7f0d52d81a2f2b40845ce663"},{"author":{"_account_id":16277,"name":"Pradeep Kumar Singh","email":"ps4openstack@gmail.com","username":"pradeep_singh"},"change_message_id":"39dbf05107fdada28bc35af65776f21025c759a2","unresolved":false,"context_lines":[{"line_number":12,"context_line":"#    License for the specific language governing permissions and limitations"},{"line_number":13,"context_line":"#    under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"from zun.api.utils import check_if_mandatory"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"class APIBase(object):"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a71b18c_d9e488a9","line":15,"in_reply_to":"3a71b18c_b9798c95","updated":"2016-12-12 10:50:24.000000000","message":"@Sudipta, I thought this function doesn\u0027t come under APIBAse class, as functionality is concerned like validation. So i moved it outside.","commit_id":"7a7e9dbcccd8b21b7f0d52d81a2f2b40845ce663"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"74e655f3a5b187fae846d6db8350c78ac167a96b","unresolved":false,"context_lines":[{"line_number":22,"context_line":"            if field in kwargs:"},{"line_number":23,"context_line":"                value \u003d kwargs[field]"},{"line_number":24,"context_line":"                setattr(self, field, value)"},{"line_number":25,"context_line":"            else:"},{"line_number":26,"context_line":"                mandatory \u003d self.fields[field].get(\u0027mandatory\u0027, False)"},{"line_number":27,"context_line":"                check_if_mandatory(field, mandatory)"},{"line_number":28,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3a71b18c_e94def72","line":25,"updated":"2016-12-12 13:38:27.000000000","message":"Do you like the idea of raising an exception here directly if you find the mandatory flag set to True?","commit_id":"7a7e9dbcccd8b21b7f0d52d81a2f2b40845ce663"}],"zun/api/utils.py":[{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"74e655f3a5b187fae846d6db8350c78ac167a96b","unresolved":false,"context_lines":[{"line_number":146,"context_line":""},{"line_number":147,"context_line":""},{"line_number":148,"context_line":"def check_if_mandatory(field, mandatory):"},{"line_number":149,"context_line":"    if mandatory:"},{"line_number":150,"context_line":"        message \u003d \u0027Required field %s is missing\u0027 % field"},{"line_number":151,"context_line":"        raise exception.ValidationError(detail\u003dmessage)"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a71b18c_6e5f2541","line":149,"updated":"2016-12-12 13:38:27.000000000","message":"Sorry for being a bit picky. But you call the function as check_if_mandatory and inside that you have another if which checks if it\u0027s mandatory or not. Instead you could just probably move this logic to be called only when you have mandatory field boolean set to True.","commit_id":"7a7e9dbcccd8b21b7f0d52d81a2f2b40845ce663"}]}
