)]}'
{"dragonflow/db/models.py":[{"author":{"_account_id":23766,"name":"Dima Kuznetsov","email":"dima.kuznetsov@toganetworks.com","username":"dimak"},"change_message_id":"374e2b5c6a82aced27c3f6986d2b93c7823b3e08","unresolved":false,"context_lines":[{"line_number":439,"context_line":"table_class_mapping \u003d {}"},{"line_number":440,"context_line":""},{"line_number":441,"context_line":""},{"line_number":442,"context_line":"def _register_models():"},{"line_number":443,"context_line":"    for _, cls in inspect.getmembers(sys.modules[__name__], inspect.isclass):"},{"line_number":444,"context_line":"        if issubclass(cls, NbDbObject) and cls is not NbDbObject:"},{"line_number":445,"context_line":"            table_class_mapping.update({cls.table_name: cls})"},{"line_number":446,"context_line":""},{"line_number":447,"context_line":""},{"line_number":448,"context_line":"def get_class_by_table(table):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6eadb0_def91082","line":445,"range":{"start_line":442,"start_character":0,"end_line":445,"end_character":61},"updated":"2016-12-14 12:28:42.000000000","message":"I think this logic is too fragile (e.g. if I want to add another base class between NbDbObject and Security group) and I don\u0027t want it to be a mix-in (because it overrides existing functionality rather than adds independent one).\n\nIf we want to go fully-automatic, I would have filtered on hastattr(obj, \u0027table_name\u0027), but I think a simple register_model(ModelClass) under each class declaration would be much more readable and straightforward.","commit_id":"a9a0693132d526c991a0e88902a2d61e0cec5359"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"b73555e9952a34541471f00a333e2a9e3629994a","unresolved":false,"context_lines":[{"line_number":439,"context_line":"table_class_mapping \u003d {}"},{"line_number":440,"context_line":""},{"line_number":441,"context_line":""},{"line_number":442,"context_line":"def _register_models():"},{"line_number":443,"context_line":"    for _, cls in inspect.getmembers(sys.modules[__name__], inspect.isclass):"},{"line_number":444,"context_line":"        if issubclass(cls, NbDbObject) and cls is not NbDbObject:"},{"line_number":445,"context_line":"            table_class_mapping.update({cls.table_name: cls})"},{"line_number":446,"context_line":""},{"line_number":447,"context_line":""},{"line_number":448,"context_line":"def get_class_by_table(table):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6eadb0_7bf1ca00","line":445,"range":{"start_line":442,"start_character":0,"end_line":445,"end_character":61},"in_reply_to":"1a6eadb0_9a84fbd4","updated":"2016-12-15 00:40:05.000000000","message":"Will update","commit_id":"a9a0693132d526c991a0e88902a2d61e0cec5359"},{"author":{"_account_id":20229,"name":"Omer Anson","email":"omer.anson@toganetworks.com","username":"oanson"},"change_message_id":"7f9bb10606f4a84fdbd6dc0d7c2e04a129cf2873","unresolved":false,"context_lines":[{"line_number":439,"context_line":"table_class_mapping \u003d {}"},{"line_number":440,"context_line":""},{"line_number":441,"context_line":""},{"line_number":442,"context_line":"def _register_models():"},{"line_number":443,"context_line":"    for _, cls in inspect.getmembers(sys.modules[__name__], inspect.isclass):"},{"line_number":444,"context_line":"        if issubclass(cls, NbDbObject) and cls is not NbDbObject:"},{"line_number":445,"context_line":"            table_class_mapping.update({cls.table_name: cls})"},{"line_number":446,"context_line":""},{"line_number":447,"context_line":""},{"line_number":448,"context_line":"def get_class_by_table(table):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a6eadb0_9a84fbd4","line":445,"range":{"start_line":442,"start_character":0,"end_line":445,"end_character":61},"in_reply_to":"1a6eadb0_def91082","updated":"2016-12-14 15:14:41.000000000","message":"I\u0027d rather forgo the fully-automatic option. I prefer every model registers itself with a call to a register function.\n\nIt may add a little development overhead, but the code would be easier to understand for new contributors. (I don\u0027t like things that happen by \u0027magic\u0027)","commit_id":"a9a0693132d526c991a0e88902a2d61e0cec5359"},{"author":{"_account_id":20229,"name":"Omer Anson","email":"omer.anson@toganetworks.com","username":"oanson"},"change_message_id":"7effbb5daf925612e7c07d4784d873cafdb66f75","unresolved":false,"context_lines":[{"line_number":20,"context_line":""},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"def register_model_class(cls):"},{"line_number":23,"context_line":"    table_class_mapping.update({cls.table_name: cls})"},{"line_number":24,"context_line":"    return cls"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1a6eadb0_61e3d333","line":23,"range":{"start_line":23,"start_character":0,"end_line":23,"end_character":53},"updated":"2016-12-15 08:13:04.000000000","message":"Why not use: table_class_mapping[cls.table_name] \u003d cls ?","commit_id":"5009fd7ea5468a5a31c3a122aea87e4dd7c5fcc8"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"18db32ecb79873d7bd6ada3b7a301162c0448885","unresolved":false,"context_lines":[{"line_number":20,"context_line":""},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"def register_model_class(cls):"},{"line_number":23,"context_line":"    table_class_mapping.update({cls.table_name: cls})"},{"line_number":24,"context_line":"    return cls"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1a6eadb0_619bd372","line":23,"range":{"start_line":23,"start_character":0,"end_line":23,"end_character":53},"in_reply_to":"1a6eadb0_61e3d333","updated":"2016-12-15 08:23:32.000000000","message":"The update method just comes to my mind when I write this code. But I think \"table_class_mapping[cls.table_name] \u003d cls\" should win a bit in performance. Will update in next respin.","commit_id":"5009fd7ea5468a5a31c3a122aea87e4dd7c5fcc8"}]}
