parameters: (project, gallery_id)
docstring: Handy shortcut to get gallery object and validate id input.
docstring_summary: Handy shortcut to get gallery object and validate id input.
docstring_tokens: Handy shortcut to get gallery object and validate id input .
function: def get_gallery(project, gallery_id):
      """ Handy shortcut to get gallery object and validate id input.
      """
      try:
          gallery_id = int(gallery_id)
      except (TypeError, ValueError):
          raise Http404
      try:
          return ContentObjectGallery.objects.for_object(project).get(pk=gallery_id)
      except ContentObjectGallery.DoesNotExist:
          raise Http404
function_tokens: def get_gallery ( project , gallery_id ) : try : gallery_id = int ( gallery_id ) except ( TypeError , ValueError ) : raise Http404 try : return ContentObjectGallery . objects . for_object ( project ) . get ( pk = gallery_id ) except ContentObjectGallery . DoesNotExist : raise Http404