Generate WebAPI resource paths with backtracking

Review Request #10117 — Created Aug. 13, 2018 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x
a508824...

Reviewers

The old method of generating fake resource paths assumed that the first
model instance that matched resource.get_queryset(...) would be
suitable in all cases, i.e., this object would have all optional
relationships that corresspond to models. For example, it assumed that
the last modified review request would have all of the following:
- A review request draft
- File attachments
- Screenshots
- Reviews
- Draft file attachments
- Draft screenshots
- Draft reviews
- Review replies
- etc.

This is problematic when we want to add a new model instance (e.g., for
the in-process DVCs work which adds new models) because all these child
objects will have to be created for the last modified model instance.

Now, we use a backtracking algorithm to iterate over path-model pairs so
that if a model does not have the requisite child objects we can
continue onto the next instance. This way, we only need to add objects
to the database that correspond to new resources, instead of duplicating
objects from the previous parent object or recreating them entirely.

Built the docs.
With this patch applied, the docs in /r/10118/ build correctly.

    Loading...