Ejemplo n.º 1
0
def source_upload_path(instance, filename):
    # At this point we already know that ext is one of VALID_SOURCE_EXTENSIONS
    # because we already checked for that in
    # /src/olympia/devhub/forms.py#WithSourceMixin.clean_source.
    for ext in VALID_SOURCE_EXTENSIONS:
        if filename.endswith(ext):
            break

    return os.path.join(
        u'version_source', id_to_path(instance.pk),
        u'{0}-{1}-src{2}'.format(instance.addon.slug, instance.version, ext))
Ejemplo n.º 2
0
def source_upload_path(instance, filename):
    # At this point we already know that ext is one of VALID_SOURCE_EXTENSIONS
    # because we already checked for that in
    # /src/olympia/devhub/forms.py#WithSourceMixin.clean_source.
    for ext in VALID_SOURCE_EXTENSIONS:
        if filename.endswith(ext):
            break

    return os.path.join(
        u'version_source',
        id_to_path(instance.pk),
        u'{0}-{1}-src{2}'.format(
            instance.addon.slug,
            instance.version,
            ext)
    )
Ejemplo n.º 3
0
 def test_with_many_digits(self):
     assert helpers.id_to_path(123456789) == '9/89/123456789'
Ejemplo n.º 4
0
 def test_with_3_digits(self):
     assert helpers.id_to_path(123) == '3/23/123'
Ejemplo n.º 5
0
 def test_with_2_digits(self):
     assert helpers.id_to_path(12) == '2/12/12'
Ejemplo n.º 6
0
 def test_with_1_digit(self):
     assert helpers.id_to_path(1) == '1/1/1'
Ejemplo n.º 7
0
 def test_with_many_digits(self):
     eq_(helpers.id_to_path(123456789), '9/89/123456789')
Ejemplo n.º 8
0
 def test_with_3_digits(self):
     eq_(helpers.id_to_path(123), '3/23/123')
Ejemplo n.º 9
0
 def test_with_2_digits(self):
     assert helpers.id_to_path(12) == '2/12/12'
Ejemplo n.º 10
0
 def test_with_1_digit(self):
     eq_(helpers.id_to_path(1), '1/1/1')
Ejemplo n.º 11
0
 def test_with_many_digits(self):
     eq_(helpers.id_to_path(123456789), '9/89/123456789')
Ejemplo n.º 12
0
 def test_with_3_digits(self):
     eq_(helpers.id_to_path(123), '3/23/123')
Ejemplo n.º 13
0
 def test_with_2_digits(self):
     eq_(helpers.id_to_path(12), '2/12/12')
Ejemplo n.º 14
0
 def test_with_1_digit(self):
     eq_(helpers.id_to_path(1), '1/1/1')
Ejemplo n.º 15
0
 def test_with_many_digits(self):
     assert helpers.id_to_path(123456789) == '9/89/123456789'
Ejemplo n.º 16
0
 def test_with_3_digits(self):
     assert helpers.id_to_path(123) == '3/23/123'
Ejemplo n.º 17
0
 def test_with_2_digits(self):
     eq_(helpers.id_to_path(12), '2/12/12')
Ejemplo n.º 18
0
 def test_with_1_digit(self):
     assert helpers.id_to_path(1) == '1/1/1'