2017-12-12 17:23:59 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2017-12-16 01:09:29 +00:00
|
|
|
"""Project exceptions."""
|
2015-08-21 20:55:02 +00:00
|
|
|
|
2017-12-07 18:19:28 +00:00
|
|
|
from django.conf import settings
|
|
|
|
from django.utils.translation import ugettext_noop as _
|
2015-08-21 20:55:02 +00:00
|
|
|
|
2017-12-07 18:19:28 +00:00
|
|
|
from readthedocs.doc_builder.exceptions import BuildEnvironmentError
|
2015-08-21 20:55:02 +00:00
|
|
|
|
|
|
|
|
2017-12-07 18:19:28 +00:00
|
|
|
class ProjectConfigurationError(BuildEnvironmentError):
|
|
|
|
|
2017-12-16 01:09:29 +00:00
|
|
|
"""Error raised trying to configure a project for build."""
|
2017-12-07 18:19:28 +00:00
|
|
|
|
|
|
|
NOT_FOUND = _(
|
|
|
|
'A configuration file was not found. '
|
|
|
|
'Make sure you have a conf.py file in your repository.'
|
|
|
|
)
|
|
|
|
|
2017-12-12 17:19:54 +00:00
|
|
|
MULTIPLE_CONF_FILES = _(
|
2017-12-15 15:20:37 +00:00
|
|
|
'We found more than one conf.py and are not sure which one to use. '
|
|
|
|
'Please, specify the correct file under the Advanced settings tab '
|
|
|
|
"in the project's Admin."
|
2017-12-12 17:19:54 +00:00
|
|
|
)
|
2017-12-07 18:19:28 +00:00
|
|
|
|
2017-12-12 17:23:59 +00:00
|
|
|
|
2017-12-07 18:19:28 +00:00
|
|
|
class RepositoryError(BuildEnvironmentError):
|
|
|
|
|
|
|
|
"""Failure during repository operation."""
|
|
|
|
|
|
|
|
PRIVATE_ALLOWED = _(
|
|
|
|
'There was a problem connecting to your repository, '
|
|
|
|
'ensure that your repository URL is correct.'
|
|
|
|
)
|
|
|
|
PRIVATE_NOT_ALLOWED = _(
|
|
|
|
'There was a problem connecting to your repository, '
|
|
|
|
'ensure that your repository URL is correct and your repository is public. '
|
|
|
|
'Private repositories are not supported.'
|
|
|
|
)
|
|
|
|
|
2018-03-23 14:08:06 +00:00
|
|
|
INVALID_SUBMODULES = _(
|
2018-12-17 21:51:29 +00:00
|
|
|
'One or more submodule URLs are not valid: {}.'
|
2018-03-23 14:08:06 +00:00
|
|
|
)
|
|
|
|
|
2018-06-12 15:44:52 +00:00
|
|
|
DUPLICATED_RESERVED_VERSIONS = _(
|
2018-06-12 06:55:41 +00:00
|
|
|
'You can not have two versions with the name latest or stable.'
|
|
|
|
)
|
|
|
|
|
2017-12-07 18:19:28 +00:00
|
|
|
def get_default_message(self):
|
|
|
|
if settings.ALLOW_PRIVATE_REPOS:
|
|
|
|
return self.PRIVATE_ALLOWED
|
|
|
|
return self.PRIVATE_NOT_ALLOWED
|
2015-11-23 01:45:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ProjectSpamError(Exception):
|
|
|
|
|
2017-12-16 01:09:29 +00:00
|
|
|
"""
|
|
|
|
Error raised when a project field has detected spam.
|
2017-12-07 18:19:28 +00:00
|
|
|
|
|
|
|
This error is not raised to users, we use this for banning users in the
|
|
|
|
background.
|
|
|
|
"""
|
2015-11-23 01:45:34 +00:00
|
|
|
|
|
|
|
pass
|