| Conditions | 4 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | # -*- coding: utf-8 -*- |
||
| 10 | def update_symbols_urls(apps, schema_editor): |
||
| 11 | if settings.DEFAULT_FILE_STORAGE == 'omaha_server.s3utils.S3Storage': |
||
| 12 | Symbols = apps.get_model("crash", "Symbols") |
||
| 13 | symbols = Symbols.objects.filter(debug_file__contains=' ').iterator() |
||
| 14 | for symbol in symbols: |
||
| 15 | old_name = symbol.file.name |
||
| 16 | if symbol.file.storage.exists(old_name): |
||
| 17 | head, tail = os.path.split(old_name) |
||
| 18 | new_name = os.path.join(head, '%s.sym' % symbol.debug_file) |
||
| 19 | storage = symbol.file.storage |
||
| 20 | file_obj = storage._open(old_name) |
||
| 21 | symbol.file.save(new_name, file_obj) |
||
| 22 | file_obj.close() |
||
| 23 | storage.delete(old_name) |
||
| 24 | else: |
||
| 25 | print "File %s was not found" % old_name |
||
| 26 | |||
| 39 | ] |