Code Duplication    Length = 10-10 lines in 2 locations

omaha_server/crash/models.py 1 location

@@ 36-45 (lines=10) @@
33
from crash.managers import CrashManager, SymbolsManager
34
35
36
def upload_to(directory, obj, filename):
37
    now = timezone.now()
38
    max_length = 255
39
    path = os.path.join(*map(str, [directory, now.year, now.month,
40
                                   now.day, uuid.uuid4(), filename]))
41
    if len(path) > max_length:
42
        name, ext = os.path.splitext(path)
43
        ext_length = len(ext)
44
        path = name[:max_length-ext_length] + ext
45
    return path
46
47
48
def crash_upload_to(obj, filename):

omaha_server/feedback/models.py 1 location

@@ 35-44 (lines=10) @@
32
from feedback.managers import FeedbackManager
33
34
35
def upload_to(directory, obj, filename):
36
    now = timezone.now()
37
    max_length = 100
38
    path = os.path.join(*map(str, [directory, now.year, now.month,
39
                                   now.day, uuid.uuid4(), filename]))
40
    if len(path) > max_length:
41
        name, ext = os.path.splitext(path)
42
        ext_length = len(ext)
43
        path = name[:max_length-ext_length] + ext
44
    return path
45
46
47
def screenshot_upload_to(obj, filename):