From: Guillaume Pellerin Date: Thu, 21 May 2015 07:24:15 +0000 (+0200) Subject: fix various bugs giving 404 instead of 500 X-Git-Tag: 1.6a~4^2~68 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=287431b52bdf429b9da4b35e05b111281d2dd2f4;p=telemeta.git fix various bugs giving 404 instead of 500 --- diff --git a/doc/content/Using-Git.rst b/doc/content/Using-Git.rst index 43d8b0af..bc840363 100644 --- a/doc/content/Using-Git.rst +++ b/doc/content/Using-Git.rst @@ -3,6 +3,7 @@ Telemeta project now uses Git for development :category: Development :date: 2011-10-26 06:53 +:tags: git Ten months ago, I started to look at other version control systems because I was fed up with the Subversion centralized model. It tested Git, Mercurial, Bazaar, etc.. Bazaar was the good choice because it allowed the dev teams to make branches easily in a decentralized environment, to push commits to the old subversion repository, to keep an easy syntax, etc... diff --git a/telemeta/management/commands/telemeta-import-corpus-from-dir.py b/telemeta/management/commands/telemeta-import-corpus-from-dir.py index c5c63797..925a6217 100644 --- a/telemeta/management/commands/telemeta-import-corpus-from-dir.py +++ b/telemeta/management/commands/telemeta-import-corpus-from-dir.py @@ -134,7 +134,7 @@ class Command(BaseCommand): corpus_id = slugify(unicode(corpus_name)) collection_id = corpus_id + '_' + slugify(unicode(collection_name)) item_id = collection_id + '_' + slugify(unicode(item_name)) - + cc = MediaCorpus.objects.filter(code=corpus_id) if cc: corpus = cc[0] diff --git a/telemeta/templatetags/telemeta_utils.py b/telemeta/templatetags/telemeta_utils.py index 7cf3488f..a069afbb 100644 --- a/telemeta/templatetags/telemeta_utils.py +++ b/telemeta/templatetags/telemeta_utils.py @@ -366,7 +366,7 @@ def to_string(list): def get_filename(object): if isinstance(object, unicode): return object.split('/')[-1] - elif object.path: + elif hasattr(object, 'path'): return object.path.split(os.sep)[-1] else: return '' diff --git a/telemeta/views/item.py b/telemeta/views/item.py index 4203a45b..2d40e40e 100644 --- a/telemeta/views/item.py +++ b/telemeta/views/item.py @@ -132,11 +132,11 @@ class ItemView(ItemBaseMixin): # get item with one of its given marker_id if not public_id and marker_id: - marker = MediaItemMarker.objects.get(public_id=marker_id) + marker = get_object_or_404(MediaItemMarker, public_id=marker_id) item_id = marker.item_id item = MediaItem.objects.get(id=item_id) else: - item = MediaItem.objects.get(public_id=public_id) + item = get_object_or_404(MediaItem, public_id=public_id) access = get_item_access(item, request.user)