)]}'
{"horizon/forms/fields.py":[{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"e25c835fb244b071dbfaa4ad37bbc3a217cf4b2e","unresolved":false,"context_lines":[{"line_number":130,"context_line":""},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"class MACAddressField(fields.Field):"},{"line_number":133,"context_line":"    \"\"\"Form field for entering a MAC address with validation."},{"line_number":134,"context_line":"    Supports all formats known by netaddr.EUI(), for example:"},{"line_number":135,"context_line":"    .. xx:xx:xx:xx:xx:xx"},{"line_number":136,"context_line":"    .. xx-xx-xx-xx-xx-xx"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a1ced50_9aca704e","line":133,"updated":"2017-03-17 18:18:58.000000000","message":"nit: It is better to add a blank line as second line. It is docstring convention.","commit_id":"fc7ce4d7d6550febccda3f14a6c2514e3c396499"},{"author":{"_account_id":15554,"name":"Bence Romsics","email":"bence.romsics@gmail.com","username":"ebenrom","status":"inactive contributor"},"change_message_id":"3c6a24d10fccc7744127ce26e5d0e916f8d227b1","unresolved":false,"context_lines":[{"line_number":130,"context_line":""},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"class MACAddressField(fields.Field):"},{"line_number":133,"context_line":"    \"\"\"Form field for entering a MAC address with validation."},{"line_number":134,"context_line":"    Supports all formats known by netaddr.EUI(), for example:"},{"line_number":135,"context_line":"    .. xx:xx:xx:xx:xx:xx"},{"line_number":136,"context_line":"    .. xx-xx-xx-xx-xx-xx"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a1ced50_6677be3a","line":133,"in_reply_to":"1a1ced50_9aca704e","updated":"2017-03-20 10:23:47.000000000","message":"Done","commit_id":"fc7ce4d7d6550febccda3f14a6c2514e3c396499"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"e25c835fb244b071dbfaa4ad37bbc3a217cf4b2e","unresolved":false,"context_lines":[{"line_number":139,"context_line":"    def validate(self, value):"},{"line_number":140,"context_line":"        super(MACAddressField, self).validate(value)"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"        if not value and not self.required:"},{"line_number":143,"context_line":"            return"},{"line_number":144,"context_line":""},{"line_number":145,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a1ced50_dadb081a","line":142,"range":{"start_line":142,"start_character":25,"end_line":142,"end_character":42},"updated":"2017-03-17 18:18:58.000000000","message":"Don\u0027t we need to validate a value even if required is False?","commit_id":"fc7ce4d7d6550febccda3f14a6c2514e3c396499"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"5d31838d613d693373daae71f7f337313593185b","unresolved":false,"context_lines":[{"line_number":139,"context_line":"    def validate(self, value):"},{"line_number":140,"context_line":"        super(MACAddressField, self).validate(value)"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"        if not value and not self.required:"},{"line_number":143,"context_line":"            return"},{"line_number":144,"context_line":""},{"line_number":145,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a1ced50_7fc5783a","line":142,"range":{"start_line":142,"start_character":25,"end_line":142,"end_character":42},"in_reply_to":"1a1ced50_2c0f652f","updated":"2017-03-20 12:45:48.000000000","message":"My previous comment was not correct and sorry if I confused you.\nI misunderstood the logic. I checked more.\n\nI think super()validate() checks if a required value is specified [1], so I think we don\u0027t need to check self.required here.\nI think \u0027if not value\u0027 is enough here. Even if self.required is True, when a specified value is specified, super().validate() already raises a ValidationError.\n\nThought?\n\n[1] https://github.com/django/django/blob/1.8.17/django/forms/fields.py#L137","commit_id":"fc7ce4d7d6550febccda3f14a6c2514e3c396499"},{"author":{"_account_id":15554,"name":"Bence Romsics","email":"bence.romsics@gmail.com","username":"ebenrom","status":"inactive contributor"},"change_message_id":"68ddb60e400a7fb64be271694a6dd76d3efe5e25","unresolved":false,"context_lines":[{"line_number":139,"context_line":"    def validate(self, value):"},{"line_number":140,"context_line":"        super(MACAddressField, self).validate(value)"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"        if not value and not self.required:"},{"line_number":143,"context_line":"            return"},{"line_number":144,"context_line":""},{"line_number":145,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a1ced50_413991a3","line":142,"range":{"start_line":142,"start_character":25,"end_line":142,"end_character":42},"in_reply_to":"1a1ced50_7fc5783a","updated":"2017-03-21 12:36:25.000000000","message":"Understood. Looking at the definition of Field.validate I also think it\u0027s perfectly reasonable to not check self.required here.","commit_id":"fc7ce4d7d6550febccda3f14a6c2514e3c396499"},{"author":{"_account_id":15554,"name":"Bence Romsics","email":"bence.romsics@gmail.com","username":"ebenrom","status":"inactive contributor"},"change_message_id":"3c6a24d10fccc7744127ce26e5d0e916f8d227b1","unresolved":false,"context_lines":[{"line_number":139,"context_line":"    def validate(self, value):"},{"line_number":140,"context_line":"        super(MACAddressField, self).validate(value)"},{"line_number":141,"context_line":""},{"line_number":142,"context_line":"        if not value and not self.required:"},{"line_number":143,"context_line":"            return"},{"line_number":144,"context_line":""},{"line_number":145,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":1,"id":"1a1ced50_2c0f652f","line":142,"range":{"start_line":142,"start_character":25,"end_line":142,"end_character":42},"in_reply_to":"1a1ced50_dadb081a","updated":"2017-03-20 10:23:47.000000000","message":"I think we validated by having \"not value and ...\" in the conditional. That is here we allow a non mandatory field to be left empty. When the field is left empty \u0027value\u0027 will be the empty string and we will exit early. When there is real input in the field we will not exit early but go on to the further validation.\n\nBut please correct me if I\u0027m misunderstanding something.","commit_id":"fc7ce4d7d6550febccda3f14a6c2514e3c396499"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"33d3907f7d911bc923c3147f9ad8edf3e9136d5c","unresolved":false,"context_lines":[{"line_number":140,"context_line":"    def validate(self, value):"},{"line_number":141,"context_line":"        super(MACAddressField, self).validate(value)"},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"        if not value and not self.required:"},{"line_number":144,"context_line":"            return"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a1ced50_a7a6f90d","line":143,"updated":"2017-03-20 18:55:16.000000000","message":"I replied you in the previous patch set.\nI still think self.required here is unnecessary and \"if not value\" is enough. When self.required is True,  super().validate() raises an exception and the logic does not reach here. If self.required is False, \"if not value\" is enough.\n\nEven though super().validate() does not raise an exception, \u0027required\u0027 parameter is not related to value validation. The validator should check a specified value is valid or not. I wonder why we need to run the validator below if \u0027value\u0027 is empty. There is no difference in the result.","commit_id":"a02c4a6d109ea94c8a0189c0b3793243725f7cbe"},{"author":{"_account_id":15554,"name":"Bence Romsics","email":"bence.romsics@gmail.com","username":"ebenrom","status":"inactive contributor"},"change_message_id":"3fd10a3db3fe5fd9900ab7449a23b52e0874232e","unresolved":false,"context_lines":[{"line_number":140,"context_line":"    def validate(self, value):"},{"line_number":141,"context_line":"        super(MACAddressField, self).validate(value)"},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"        if not value and not self.required:"},{"line_number":144,"context_line":"            return"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a1ced50_c14d813f","line":143,"in_reply_to":"1a1ced50_a7a6f90d","updated":"2017-03-21 12:36:30.000000000","message":"Done","commit_id":"a02c4a6d109ea94c8a0189c0b3793243725f7cbe"}]}
