Przeglądaj źródła

try to fix strange issue with upload

master
tr4ck3ur des JM2L 9 lat temu
rodzic
commit
d5055ee87d
1 zmienionych plików z 13 dodań i 9 usunięć
  1. +13
    -9
      jm2l/upload.py

+ 13
- 9
jm2l/upload.py Wyświetl plik

@@ -100,44 +100,48 @@ class MediaPath():
slug = Place.by_id(linked_id).slug
if media_table=='salle':
slug = SallePhy.by_id(linked_id).slug
p = IMAGEPATH + [ media_table ] + [ slug ]
p = IMAGEPATH + [ media_table, slug ]
elif media_table=='presse':
# Use Year in linked_id
p = IMAGEPATH + [ media_table ] + [ linked_id ]
p = IMAGEPATH + [ media_table, linked_id ]
elif media_table=='tasks':
# Use Current Year
p = IMAGEPATH + [ str(CurrentYear), media_table ] + [ linked_id ]
p = IMAGEPATH + [ str(CurrentYear), media_table, linked_id ]
elif media_table=='poles':
# Use Current Year
p = IMAGEPATH + [ str(CurrentYear), media_table ] + [ linked_id ]
p = IMAGEPATH + [ str(CurrentYear), media_table, linked_id ]
elif media_table in ['RIB', 'Justif']:
slug = User.by_id(linked_id).slug
p = IMAGEPATH + ['users'] + [ slug ] + [ self.media_table ]
p = IMAGEPATH + ['users', slug , media_table ]
elif media_table=='users':
user = User.by_id(linked_id)
if not user:
raise HTTPNotFound()
else:
slug = user.slug
p = IMAGEPATH + ['users'] + [ slug ]
p = IMAGEPATH + ['users', slug ]
elif media_table=='badge':
user = User.by_id(linked_id)
if not user:
raise HTTPNotFound()
else:
slug = user.slug
p = IMAGEPATH + ['badge'] + [ slug ]
p = IMAGEPATH + ['badge', slug ]
elif media_table=='event':
ev = Event.by_id(linked_id)
slug = ev.slug
year = ev.for_year
p = IMAGEPATH + ['event'] + [ str(year) ] + [ slug ]
p = IMAGEPATH + ['event', str(year), slug ]

if name:
p += [ name ]
TargetPath = os.path.join('jm2l/upload', *p)
if not os.path.isdir(os.path.dirname(TargetPath)):
os.makedirs(os.path.dirname(TargetPath))
try:
os.makedirs(os.path.dirname(TargetPath))
except OSError, e:
if e.errno != 17:
raise e
return os.path.join('jm2l/upload', *p)

def ExtMimeIcon(self, mime):


Ładowanie…
Anuluj
Zapisz