Skip to content

Fix sphinx domain models and migrations #5363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion readthedocs/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,9 @@ def _update_intersphinx_data(version, path, commit):
:param commit: Commit that updated path
"""
object_file = os.path.join(path, 'objects.inv')
if not os.path.exists(object_file):
log.debug('No objects.inv, skipping intersphinx indexing.')
return

# These classes are copied from Sphinx
# https://git.io/fhFbI
Expand Down Expand Up @@ -1559,7 +1562,10 @@ def sync_callback(_, version_pk, commit, *args, **kwargs):

The first argument is the result from previous tasks, which we discard.
"""
fileify(version_pk, commit=commit)
try:
fileify(version_pk, commit=commit)
except Exception:
log.exception('Post sync tasks failed, not stopping build')


@app.task()
Expand Down
42 changes: 42 additions & 0 deletions readthedocs/sphinx_domains/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-02-27 16:23
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields


class Migration(migrations.Migration):

initial = True

dependencies = [
('builds', '0006_add_config_field'),
('projects', '0040_increase_path_max_length'),
]

operations = [
migrations.CreateModel(
name='SphinxDomain',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
('commit', models.CharField(max_length=255, null=True, verbose_name='Commit')),
('domain', models.CharField(max_length=255, verbose_name='Domain')),
('name', models.CharField(max_length=255, verbose_name='Name')),
('display_name', models.CharField(max_length=255, verbose_name='Display Name')),
('type', models.CharField(max_length=255, verbose_name='Type')),
('doc_name', models.CharField(max_length=255, verbose_name='Doc Name')),
('anchor', models.CharField(max_length=255, verbose_name='Anchor')),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Max-length isn't reflected in the migration file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to push the 2nd migration. Need it for prod.

('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sphinx_domains', to='projects.Project')),
('version', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sphinx_domains', to='builds.Version', verbose_name='Version')),
],
options={
'ordering': ('-modified', '-created'),
'get_latest_by': 'modified',
'abstract': False,
},
),
]
Empty file.
8 changes: 4 additions & 4 deletions readthedocs/sphinx_domains/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ class SphinxDomain(TimeStampedModel):
)
name = models.CharField(
_('Name'),
max_length=255,
max_length=4092,
)
display_name = models.CharField(
_('Display Name'),
max_length=255,
max_length=4092,
)
type = models.CharField(
_('Type'),
max_length=255,
)
doc_name = models.CharField(
_('Doc Name'),
max_length=255,
max_length=4092,
)
anchor = models.CharField(
_('Anchor'),
max_length=255,
max_length=4092,
)
objects = RelatedProjectQuerySet.as_manager()

Expand Down