Show proper error to user when conf.py is not found
@@ -533,8 +533,20 @@ class Project(models.Model):
if len(files) == 1:
return files[0]
for filename in files:
+ # When multiples conf.py files, we look up the first one that
+ # contains the `doc` word in its path and return this one
if filename.find('doc', 70) != -1:
return filename
+
+ # If the project has more than one conf.py file but none of them have
+ # the `doc` word in the path, we raise an error informing this to the user
+ if len(files) > 0:
+ raise ProjectConfigurationError(_(
+ "There are more than one conf.py file and none of them say doc "
+ "in their path, we don't know which one use. Please, select "
+ "the correct one under the Advanced settings tab in the "
+ "project's Admin."))
+
raise ProjectConfigurationError(
ProjectConfigurationError.NOT_FOUND
)
