Avoid false positives in resource hinting

This commit is contained in:
Alexandru Coman 2017-02-14 12:56:06 +02:00
parent 70bb73f7b3
commit fb31fb7c6c
No known key found for this signature in database
GPG Key ID: A7B6A9021F704507
1 changed files with 5 additions and 1 deletions

View File

@ -327,7 +327,11 @@ class Resource(model.Model):
resource_id="(?P<resource_id>[^/]+)",
parent_id="(?P<parent_id>[^/]+)",
grandparent_id="(?P<grandparent_id>[^/]+)")
regexp = re.sub("(/networking/v[0-9]+)/", "", regexp)
regexp = re.sub("(/networking/v[0-9]+)", "", regexp)
# Note(alexcoman): In order to avoid any false positives
# we will force the regexp to match the entire resource
# reference.
regexp = "^{regexp}$".format(regexp=regexp)
self._regexp[model_cls] = re.compile(regexp)
def get_resource(self):