Completed
Push — master ( d73fd0...3a2f21 )
by
unknown
01:31
created

update_symbols_urls()   A

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
1
# -*- coding: utf-8 -*-
2
# Generated by Django 1.9.6 on 2017-03-03 07:27
3
from __future__ import unicode_literals
4
import os
5
6
from django.db import models, migrations
7
8
9
def update_symbols_urls(apps, schema_editor):
10
    Symbol = apps.get_model("crash", "Symbols")
11
    symbols = Symbol.objects.filter(debug_file__contains=' ').iterator()
12
    for symbol in symbols:
13
        head, tail = os.path.split(symbol.file.name)
14
        symbol.file.name = os.path.join(head, '%s.sym' % symbol.debug_file)
15
        symbol.save()
16
17
18
class Migration(migrations.Migration):
19
20
    dependencies = [
21
        ('crash', '0025_set_symbols_size'),
22
    ]
23
24
    operations = [
25
        migrations.RunPython(
26
            update_symbols_urls,
27
            reverse_code=migrations.RunPython.noop
28
        ),
29
    ]
30