-def entry(request, type_db, slug):
- lang = request.LANGUAGE_CODE
- args = {'type': type_db, 'slug_%s' % lang: slug}
- if not request.user.has_perm('migdal.change_entry'):
- args['published_%s' % lang] = True
- entry = get_object_or_404(Entry, **args)
+def entry(request, type_db=None, slug=None, entry=None):
+ if entry is None:
+ lang = request.LANGUAGE_CODE
+ args = {'type': type_db, 'slug_%s' % lang: slug}
+ entry = get_object_or_404(Entry, **args)
+ if not entry.published and not request.user.has_perm('migdal.change_entry'):
+ raise Http404
+ set_current_object(request, entry, in_url=slug is not None)