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.'
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
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.'
|
|
|
|
)
|
|
|
|
|
|
|
|
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
|