| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import csv | 5 import csv |
| 6 import logging | 6 import logging |
| 7 import operator | 7 import operator |
| 8 from StringIO import StringIO | 8 from StringIO import StringIO |
| 9 | 9 |
| 10 import object_store | 10 import object_store |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 for issue_dict in issues_reader: | 35 for issue_dict in issues_reader: |
| 36 id = issue_dict.get('ID', '') | 36 id = issue_dict.get('ID', '') |
| 37 title = issue_dict.get('Summary', '') | 37 title = issue_dict.get('Summary', '') |
| 38 if not id or not title: | 38 if not id or not title: |
| 39 continue | 39 continue |
| 40 issues.append({ 'id': id, 'title': title }) | 40 issues.append({ 'id': id, 'title': title }) |
| 41 issues = sorted(issues, key=operator.itemgetter('title')) | 41 issues = sorted(issues, key=operator.itemgetter('title')) |
| 42 self._object_store.Set(url, issues, object_store.KNOWN_ISSUES) | 42 self._object_store.Set(url, issues, object_store.KNOWN_ISSUES) |
| 43 return issues | 43 return issues |
| 44 | 44 |
| 45 def __getitem__(self, key): | |
| 46 return self.get(key) | |
| 47 | |
| 48 def get(self, key): | 45 def get(self, key): |
| 49 return { | 46 return { |
| 50 'open': self.GetIssues(OPEN_ISSUES_CSV_URL), | 47 'open': self.GetIssues(OPEN_ISSUES_CSV_URL), |
| 51 'closed': self.GetIssues(CLOSED_ISSUES_CSV_URL) | 48 'closed': self.GetIssues(CLOSED_ISSUES_CSV_URL) |
| 52 }.get(key, None) | 49 }.get(key, None) |
| OLD | NEW |