)]}'
{"tacker_horizon/openstack_dashboard/dashboards/nfv/constants.py":[{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"c3b388de242c639c8c7c5a539f9d6aa1c6f72e11","unresolved":false,"context_lines":[{"line_number":13,"context_line":"# under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"FILE_SIZE \u003d 100"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aa78d24_c8bf77ce","line":16,"range":{"start_line":16,"start_character":12,"end_line":16,"end_character":15},"updated":"2016-07-12 09:10:07.000000000","message":"Don\u0027t we have units? 100Bytes or 100 KBytes, or MBytes?","commit_id":"1c551e8e23c2d31d602815e16f9adf106f03b08b"},{"author":{"_account_id":22061,"name":"Neeldhwaj Pathak","email":"neeldhwaj.pathak@imaginea.com","username":"neel"},"change_message_id":"e3016b59605e622e07119ea619011c45532ecdf2","unresolved":false,"context_lines":[{"line_number":13,"context_line":"# under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"FILE_SIZE \u003d 100"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aa78d24_884f2f33","line":16,"range":{"start_line":16,"start_character":12,"end_line":16,"end_character":15},"updated":"2016-07-12 09:22:55.000000000","message":"We need to restrict the file size to 64K as db supports max of 65535. Check [1]\n[1] https://github.com/openstack/tacker/blob/master/tacker/db/vm/vm_db.py#L89","commit_id":"1c551e8e23c2d31d602815e16f9adf106f03b08b"},{"author":{"_account_id":18955,"name":"dharmendra","email":"dharmendra.kushwaha@gmail.com","username":"dharmendra"},"change_message_id":"8a8d9d17d42845180dbeee93b73060794c889845","unresolved":false,"context_lines":[{"line_number":13,"context_line":"# under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"FILE_SIZE \u003d 100"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aa78d24_32070a83","line":16,"range":{"start_line":16,"start_character":12,"end_line":16,"end_character":15},"in_reply_to":"1aa78d24_884f2f33","updated":"2016-07-14 08:57:46.000000000","message":"@Neeldhwaj\nYes, we need to restrict the max file size, Although I think we should not relate it directly with db size.\n\n@Sridhar:\nPlease suggest your opinion for keeping a max file size.","commit_id":"1c551e8e23c2d31d602815e16f9adf106f03b08b"},{"author":{"_account_id":9631,"name":"sajuptpm","email":"sajuptpm@gmail.com","username":"sajuptpm"},"change_message_id":"5ddf80f896019848074dd78e43c66072c6dc34ea","unresolved":false,"context_lines":[{"line_number":13,"context_line":"# under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"FILE_SIZE \u003d 100"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aa78d24_7921f34c","line":16,"range":{"start_line":16,"start_character":12,"end_line":16,"end_character":15},"in_reply_to":"1aa78d24_884f2f33","updated":"2016-07-12 09:59:04.000000000","message":"done","commit_id":"1c551e8e23c2d31d602815e16f9adf106f03b08b"},{"author":{"_account_id":9631,"name":"sajuptpm","email":"sajuptpm@gmail.com","username":"sajuptpm"},"change_message_id":"5ddf80f896019848074dd78e43c66072c6dc34ea","unresolved":false,"context_lines":[{"line_number":13,"context_line":"# under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"FILE_SIZE \u003d 100"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aa78d24_591eb70c","line":16,"range":{"start_line":16,"start_character":12,"end_line":16,"end_character":15},"in_reply_to":"1aa78d24_c8bf77ce","updated":"2016-07-12 09:59:04.000000000","message":"done","commit_id":"1c551e8e23c2d31d602815e16f9adf106f03b08b"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"1649eb9e5fa0e7870667f868b0c56d7b1939daf6","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":"UPLOAD_FILE_SIZE \u003d 65535"}],"source_content_type":"text/x-python","patch_set":11,"id":"fa7ab95a_3ae02396","line":15,"range":{"start_line":15,"start_character":17,"end_line":15,"end_character":18},"updated":"2016-09-02 02:09:35.000000000","message":"add a comment for the unit","commit_id":"b6750be74281318ee259df705bce93472a82814a"}],"tacker_horizon/openstack_dashboard/dashboards/nfv/utils.py":[{"author":{"_account_id":18955,"name":"dharmendra","email":"dharmendra.kushwaha@gmail.com","username":"dharmendra"},"change_message_id":"271dd31ea8165442027d5090e1622a3694edc30f","unresolved":false,"context_lines":[{"line_number":17,"context_line":"from tacker_horizon.openstack_dashboard.dashboards.nfv import constants"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def validate_file_size(_file):"},{"line_number":21,"context_line":"    return _file.size \u003c\u003d constants.FILE_SIZE * units.Ki"}],"source_content_type":"text/x-python","patch_set":5,"id":"1aa78d24_531b4a73","line":21,"range":{"start_line":20,"start_character":0,"end_line":21,"end_character":55},"updated":"2016-07-12 01:37:56.000000000","message":"Can we write it something like as mentioned below So other can just call without any more checks:\n\ndef validate_file_size(_file):\n    if not _file.size \u003c\u003d constants.FILE_SIZE * units.Ki:\n        msg \u003d \u0027File {f_name} exceeds maximum size\\\n              ({size}kb)\u0027.format(f_name\u003d_file.name,\\\n               size\u003dconstants.FILE_SIZE)\n            raise forms.ValidationError(_(msg))","commit_id":"8fd20ecbf026e04e9d813a75e7915e6aa080548b"},{"author":{"_account_id":22061,"name":"Neeldhwaj Pathak","email":"neeldhwaj.pathak@imaginea.com","username":"neel"},"change_message_id":"e3016b59605e622e07119ea619011c45532ecdf2","unresolved":false,"context_lines":[{"line_number":20,"context_line":"from tacker_horizon.openstack_dashboard.dashboards.nfv import constants"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"def validate_file_size(_file):"},{"line_number":24,"context_line":"    if _file.size \u003e constants.FILE_SIZE * units.Ki:"},{"line_number":25,"context_line":"        msg \u003d _(\u0027%(file_name)s exceeds maximum size (%(size)skb)\u0027) \\"},{"line_number":26,"context_line":"            % {\u0027file_name\u0027: _file.name, \u0027size\u0027: constants.FILE_SIZE}"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aa78d24_135a50f2","line":23,"updated":"2016-07-12 09:22:55.000000000","message":"I believe, we can improve upon this function to make it more generic. Instead of using constant here, we can pass the predefined max file size as the second argument. This improved function will help and can be reused if we want to validate the file size of varied file types having different max file sizes.","commit_id":"1c551e8e23c2d31d602815e16f9adf106f03b08b"},{"author":{"_account_id":9631,"name":"sajuptpm","email":"sajuptpm@gmail.com","username":"sajuptpm"},"change_message_id":"5ddf80f896019848074dd78e43c66072c6dc34ea","unresolved":false,"context_lines":[{"line_number":20,"context_line":"from tacker_horizon.openstack_dashboard.dashboards.nfv import constants"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"def validate_file_size(_file):"},{"line_number":24,"context_line":"    if _file.size \u003e constants.FILE_SIZE * units.Ki:"},{"line_number":25,"context_line":"        msg \u003d _(\u0027%(file_name)s exceeds maximum size (%(size)skb)\u0027) \\"},{"line_number":26,"context_line":"            % {\u0027file_name\u0027: _file.name, \u0027size\u0027: constants.FILE_SIZE}"}],"source_content_type":"text/x-python","patch_set":6,"id":"1aa78d24_1928af32","line":23,"in_reply_to":"1aa78d24_135a50f2","updated":"2016-07-12 09:59:04.000000000","message":"done","commit_id":"1c551e8e23c2d31d602815e16f9adf106f03b08b"},{"author":{"_account_id":18955,"name":"dharmendra","email":"dharmendra.kushwaha@gmail.com","username":"dharmendra"},"change_message_id":"654afd6cddc60ac297eaa53be1b829d26117fa4a","unresolved":false,"context_lines":[{"line_number":17,"context_line":"from horizon import forms"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def validate_file_size(_file, size, unit):"},{"line_number":21,"context_line":"    if _file.size \u003e size:"},{"line_number":22,"context_line":"        msg \u003d _(\u0027%(file_name)s exceeds maximum size (%(size)s%(unit)s)\u0027) \\"},{"line_number":23,"context_line":"            % {\u0027file_name\u0027: _file.name, \u0027size\u0027: size, \u0027unit\u0027: unit}"}],"source_content_type":"text/x-python","patch_set":9,"id":"1aa78d24_442e228d","line":20,"range":{"start_line":20,"start_character":36,"end_line":20,"end_character":40},"updated":"2016-07-15 05:56:14.000000000","message":"Why to pass unit here, if not used in size check?\n\nEx. A file with size just 2Bytes, will also raise error even we call validate_file_size(\u003cfile name\u003e, 1, \u0027Gb\u0027)\n\nPlease verify this.","commit_id":"06213e771344d2df1727da6828fc99890137d065"},{"author":{"_account_id":9631,"name":"sajuptpm","email":"sajuptpm@gmail.com","username":"sajuptpm"},"change_message_id":"a90481381613972d24ba9bd9c51de1d26b3eb11b","unresolved":false,"context_lines":[{"line_number":17,"context_line":"from horizon import forms"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"def validate_file_size(_file, size, unit):"},{"line_number":21,"context_line":"    if _file.size \u003e size:"},{"line_number":22,"context_line":"        msg \u003d _(\u0027%(file_name)s exceeds maximum size (%(size)s%(unit)s)\u0027) \\"},{"line_number":23,"context_line":"            % {\u0027file_name\u0027: _file.name, \u0027size\u0027: size, \u0027unit\u0027: unit}"}],"source_content_type":"text/x-python","patch_set":9,"id":"1aa78d24_be838e54","line":20,"range":{"start_line":20,"start_character":36,"end_line":20,"end_character":40},"in_reply_to":"1aa78d24_442e228d","updated":"2016-07-15 07:41:13.000000000","message":"Done, Please check it.","commit_id":"06213e771344d2df1727da6828fc99890137d065"}],"tacker_horizon/openstack_dashboard/dashboards/nfv/vnfmanager/forms.py":[{"author":{"_account_id":18955,"name":"dharmendra","email":"dharmendra.kushwaha@gmail.com","username":"dharmendra"},"change_message_id":"831368e81e2cbe7c724ecdecba9f604ec6ccd9c2","unresolved":false,"context_lines":[{"line_number":129,"context_line":""},{"line_number":130,"context_line":"        if param_file:"},{"line_number":131,"context_line":"            _param_file \u003d self.files[\u0027param_file\u0027]"},{"line_number":132,"context_line":"            if _param_file.size \u003e 100 * units.Ki:"},{"line_number":133,"context_line":"                msg \u003d _(\u0027Parameter Value File exceeds maximum size (100kb)\u0027)"},{"line_number":134,"context_line":"                raise forms.ValidationError(msg)"},{"line_number":135,"context_line":"            data[\u0027param_values\u0027] \u003d _param_file.read()"},{"line_number":136,"context_line":"        elif param_raw:"},{"line_number":137,"context_line":"            data[\u0027param_values\u0027] \u003d data[\u0027direct_input\u0027]"}],"source_content_type":"text/x-python","patch_set":1,"id":"1aa78d24_264f2338","line":134,"range":{"start_line":132,"start_character":0,"end_line":134,"end_character":48},"updated":"2016-07-07 06:47:21.000000000","message":"Can we create a common method for this, instead of writing same code at multiple places?","commit_id":"9a45a4bf061d5d78bf2d5fc926dc4599fda97687"}]}
