|
@@ -100,44 +100,48 @@ class MediaPath(): |
|
|
slug = Place.by_id(linked_id).slug |
|
|
slug = Place.by_id(linked_id).slug |
|
|
if media_table=='salle': |
|
|
if media_table=='salle': |
|
|
slug = SallePhy.by_id(linked_id).slug |
|
|
slug = SallePhy.by_id(linked_id).slug |
|
|
p = IMAGEPATH + [ media_table ] + [ slug ] |
|
|
|
|
|
|
|
|
p = IMAGEPATH + [ media_table, slug ] |
|
|
elif media_table=='presse': |
|
|
elif media_table=='presse': |
|
|
# Use Year in linked_id |
|
|
# Use Year in linked_id |
|
|
p = IMAGEPATH + [ media_table ] + [ linked_id ] |
|
|
|
|
|
|
|
|
p = IMAGEPATH + [ media_table, linked_id ] |
|
|
elif media_table=='tasks': |
|
|
elif media_table=='tasks': |
|
|
# Use Current Year |
|
|
# Use Current Year |
|
|
p = IMAGEPATH + [ str(CurrentYear), media_table ] + [ linked_id ] |
|
|
|
|
|
|
|
|
p = IMAGEPATH + [ str(CurrentYear), media_table, linked_id ] |
|
|
elif media_table=='poles': |
|
|
elif media_table=='poles': |
|
|
# Use Current Year |
|
|
# 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']: |
|
|
elif media_table in ['RIB', 'Justif']: |
|
|
slug = User.by_id(linked_id).slug |
|
|
slug = User.by_id(linked_id).slug |
|
|
p = IMAGEPATH + ['users'] + [ slug ] + [ self.media_table ] |
|
|
|
|
|
|
|
|
p = IMAGEPATH + ['users', slug , media_table ] |
|
|
elif media_table=='users': |
|
|
elif media_table=='users': |
|
|
user = User.by_id(linked_id) |
|
|
user = User.by_id(linked_id) |
|
|
if not user: |
|
|
if not user: |
|
|
raise HTTPNotFound() |
|
|
raise HTTPNotFound() |
|
|
else: |
|
|
else: |
|
|
slug = user.slug |
|
|
slug = user.slug |
|
|
p = IMAGEPATH + ['users'] + [ slug ] |
|
|
|
|
|
|
|
|
p = IMAGEPATH + ['users', slug ] |
|
|
elif media_table=='badge': |
|
|
elif media_table=='badge': |
|
|
user = User.by_id(linked_id) |
|
|
user = User.by_id(linked_id) |
|
|
if not user: |
|
|
if not user: |
|
|
raise HTTPNotFound() |
|
|
raise HTTPNotFound() |
|
|
else: |
|
|
else: |
|
|
slug = user.slug |
|
|
slug = user.slug |
|
|
p = IMAGEPATH + ['badge'] + [ slug ] |
|
|
|
|
|
|
|
|
p = IMAGEPATH + ['badge', slug ] |
|
|
elif media_table=='event': |
|
|
elif media_table=='event': |
|
|
ev = Event.by_id(linked_id) |
|
|
ev = Event.by_id(linked_id) |
|
|
slug = ev.slug |
|
|
slug = ev.slug |
|
|
year = ev.for_year |
|
|
year = ev.for_year |
|
|
p = IMAGEPATH + ['event'] + [ str(year) ] + [ slug ] |
|
|
|
|
|
|
|
|
p = IMAGEPATH + ['event', str(year), slug ] |
|
|
|
|
|
|
|
|
if name: |
|
|
if name: |
|
|
p += [ name ] |
|
|
p += [ name ] |
|
|
TargetPath = os.path.join('jm2l/upload', *p) |
|
|
TargetPath = os.path.join('jm2l/upload', *p) |
|
|
if not os.path.isdir(os.path.dirname(TargetPath)): |
|
|
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) |
|
|
return os.path.join('jm2l/upload', *p) |
|
|
|
|
|
|
|
|
def ExtMimeIcon(self, mime): |
|
|
def ExtMimeIcon(self, mime): |
|
|