)]}'
{"openstack_dashboard/dashboards/admin/users/forms.py":[{"author":{"_account_id":6914,"name":"Tatiana Ovchinnikova","email":"t.v.ovtchinnikova@gmail.com","username":"tmazur"},"change_message_id":"466bc71987d577ab8c35dbc70c779c5afb11681d","unresolved":false,"context_lines":[{"line_number":53,"context_line":"        for project in projects:"},{"line_number":54,"context_line":"            if project.enabled:"},{"line_number":55,"context_line":"                # if already one choice and another to be added, we also"},{"line_number":56,"context_line":"                # add the text \"select a project"},{"line_number":57,"context_line":"                if len(project_choices) \u003d\u003d 1:"},{"line_number":58,"context_line":"                    project_choices.insert(0, select_project)"},{"line_number":59,"context_line":"                project_choices.append((project.id, project.name))"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F%2B1tc%3D","line":56,"updated":"2013-11-19 14:13:18.000000000","message":"Please add a quotation mark at the end of line.","commit_id":"fbdebee1ae64b485cc629c738b2641c4bca4b91f"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"50530e8cbd19616c0e89faf03af59c8826272bec","unresolved":false,"context_lines":[{"line_number":56,"context_line":"                # add the text \"select a project\""},{"line_number":57,"context_line":"                if len(project_choices) \u003d\u003d 1:"},{"line_number":58,"context_line":"                    project_choices.insert(0, select_project)"},{"line_number":59,"context_line":"                project_choices.append((project.id, project.name))"},{"line_number":60,"context_line":"        self.fields[\u0027project\u0027].choices \u003d project_choices"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    def clean(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2BiZE%3D","line":59,"updated":"2013-11-24 22:12:57.000000000","message":"How about adding the following just before L.60?\n\n   if len(project_choices) \u003e 1:\n       project_choices.insert(0, select_project)\n\nThe logic at L.55-58 is correct, but I think this is easier to understand. If you have a concern about a cost of checking the length of the list, L.55-58 looks okay.","commit_id":"9288846a2f338e546ceca4044f07a2d498b2a4cc"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"fe9e2c5becf196cd982aa9f595764a6c11f9c84b","unresolved":false,"context_lines":[{"line_number":56,"context_line":"                # add the text \"select a project\""},{"line_number":57,"context_line":"                if len(project_choices) \u003d\u003d 1:"},{"line_number":58,"context_line":"                    project_choices.insert(0, select_project)"},{"line_number":59,"context_line":"                project_choices.append((project.id, project.name))"},{"line_number":60,"context_line":"        self.fields[\u0027project\u0027].choices \u003d project_choices"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    def clean(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2BfP8%3D","line":59,"in_reply_to":"AAAATn%2F%2BiZE%3D","updated":"2013-11-25 15:27:04.000000000","message":"Agree with Akihiro, to take it a bit further we could also display a message when there a no projects. \n\nThis is the common pattern used:\n\nif not project_choices:\n    project_choices.insert(0, _(\"No available projects\"))\nelif len(project_choices) \u003e 1:\n       project_choices.insert(0, _(\"Select a project\"))","commit_id":"9288846a2f338e546ceca4044f07a2d498b2a4cc"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"54974d6c3333561dd4ba747654063a3f1a4b9c11","unresolved":false,"context_lines":[{"line_number":53,"context_line":"            if project.enabled:"},{"line_number":54,"context_line":"                project_choices.append((project.id, project.name))"},{"line_number":55,"context_line":"        if not project_choices:"},{"line_number":56,"context_line":"            project_choices.insert(0, _(\"No available projects\"))"},{"line_number":57,"context_line":"        elif len(project_choices) \u003e 1:"},{"line_number":58,"context_line":"            project_choices.insert(0, _(\"Select a project\"))"},{"line_number":59,"context_line":"        self.fields[\u0027project\u0027].choices \u003d project_choices"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATn%2F%2BYqQ%3D","line":56,"updated":"2013-11-26 16:48:31.000000000","message":"We need to pass a tuple.\n\n  insert(0, (\u0027\u0027, _(\"No available projects\")))","commit_id":"58f31146a3f5d1f06db46b39103c57dc67631c14"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"54974d6c3333561dd4ba747654063a3f1a4b9c11","unresolved":false,"context_lines":[{"line_number":55,"context_line":"        if not project_choices:"},{"line_number":56,"context_line":"            project_choices.insert(0, _(\"No available projects\"))"},{"line_number":57,"context_line":"        elif len(project_choices) \u003e 1:"},{"line_number":58,"context_line":"            project_choices.insert(0, _(\"Select a project\"))"},{"line_number":59,"context_line":"        self.fields[\u0027project\u0027].choices \u003d project_choices"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def clean(self):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATn%2F%2BYqU%3D","line":58,"updated":"2013-11-26 16:48:31.000000000","message":"Ditto","commit_id":"58f31146a3f5d1f06db46b39103c57dc67631c14"}]}
