@@ -934,33 +934,32 @@ def file_upload(request):
934
934
rendered = None
935
935
if form .description .data :
936
936
description_content_type = form .description_content_type .data
937
- # if not description_content_type:
938
- # description_content_type = "text/x-rst"
937
+ if not description_content_type :
938
+ description_content_type = "text/x-rst"
939
+
939
940
rendered = readme .render (
940
- form .description .data , description_content_type # use_fallback=False
941
+ form .description .data , description_content_type , use_fallback = False
941
942
)
942
943
943
944
# Uploading should prevent broken rendered descriptions.
944
- # Temporarily disabled, see
945
- # https://github.com/pypa/warehouse/issues/4079
946
- # if rendered is None:
947
- # if form.description_content_type.data:
948
- # message = (
949
- # "The description failed to render "
950
- # "for '{description_content_type}'."
951
- # ).format(description_content_type=description_content_type)
952
- # else:
953
- # message = (
954
- # "The description failed to render "
955
- # "in the default format of reStructuredText."
956
- # )
957
- # raise _exc_with_message(
958
- # HTTPBadRequest,
959
- # "{message} See {projecthelp} for more information.".format(
960
- # message=message,
961
- # projecthelp=request.help_url(_anchor="description-content-type"),
962
- # ),
963
- # ) from None
945
+ if rendered is None :
946
+ if form .description_content_type .data :
947
+ message = (
948
+ "The description failed to render "
949
+ "for '{description_content_type}'."
950
+ ).format (description_content_type = description_content_type )
951
+ else :
952
+ message = (
953
+ "The description failed to render "
954
+ "in the default format of reStructuredText."
955
+ )
956
+ raise _exc_with_message (
957
+ HTTPBadRequest ,
958
+ "{message} See {projecthelp} for more information." .format (
959
+ message = message ,
960
+ projecthelp = request .help_url (_anchor = "description-content-type" ),
961
+ ),
962
+ ) from None
964
963
965
964
try :
966
965
canonical_version = packaging .utils .canonicalize_version (form .version .data )
0 commit comments