From 704de268d18e313bfca4e0561ff2d97cee6df7c4 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Wed, 18 Oct 2017 14:43:11 +0200 Subject: [PATCH] replace first the url before the terms --- server.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server.py b/server.py index 17f865c..6180d88 100644 --- a/server.py +++ b/server.py @@ -53,13 +53,14 @@ class Anonymous_Github: application.jinja_env.add_extension('jinja2.ext.do') def removeTerms(content, repository): - for term in repository['terms']: - content = re.compile(term, re.IGNORECASE).sub("XXX", content) repo = repository['repository'] if repo[-1] == '/': repo = repo[0:-1] - content = re.compile(repo + "/blob/master", re.IGNORECASE).sub(self.public_url + "/repository/" + repository["id"], content) - content = re.compile(repo, re.IGNORECASE).sub(self.public_url+"/repository/" + repository["id"], content) + content = re.compile(repo + "/blob/master", re.IGNORECASE).sub( + self.public_url + "/repository/" + repository["id"], content) + content = re.compile(repo, re.IGNORECASE).sub(self.public_url + "/repository/" + repository["id"], content) + for term in repository['terms']: + content = re.compile(term, re.IGNORECASE).sub("XXX", content) return content @application.template_filter('file_render', )