Generate WebAPI resource paths with backtracking
Review Request #1395 — Created Sept. 28, 2018 and submitted
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-progress 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. Testing Done: Built the docs. With this patch applied, the docs in /r/10118/ build correctly. Reviewed at https://reviews.reviewboard.org/r/10117/
Loading file attachments...