aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-10-25 20:58:31 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2016-10-26 15:41:32 +1300
commit7ddf8f58d63d5571df7b952a98c13c6a7c39e074 (patch)
tree14082ac5db0072318e01ef05f5fef2753c64f836
parentd5b0d578a6fc5c4acb7a8cf957afb5f18e9f6ad3 (diff)
downloadopenembedded-core-contrib-7ddf8f58d63d5571df7b952a98c13c6a7c39e074.tar.gz
recipedetail: don't show homepage as link if not URL
Sometimes people put values that aren't URLs into the HOMEPAGE variable. If that's the case, then we should not turn that value into a link which will be invalid. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--layerindex/models.py6
-rw-r--r--templates/layerindex/recipedetail.html8
2 files changed, 13 insertions, 1 deletions
diff --git a/layerindex/models.py b/layerindex/models.py
index 869d4a3e10..746fad445f 100644
--- a/layerindex/models.py
+++ b/layerindex/models.py
@@ -292,6 +292,12 @@ class Recipe(models.Model):
else:
return self.filename.split('_')[0]
+ def homepage_url_only(self):
+ if '://' in self.homepage:
+ return self.homepage
+ else:
+ return None
+
def __str__(self):
return os.path.join(self.filepath, self.filename)
diff --git a/templates/layerindex/recipedetail.html b/templates/layerindex/recipedetail.html
index c0199a1530..5b83886d10 100644
--- a/templates/layerindex/recipedetail.html
+++ b/templates/layerindex/recipedetail.html
@@ -72,7 +72,13 @@
</tr>
<tr>
<th>Homepage</th>
- <td>{% if recipe.homepage %}<a href="{{ recipe.homepage }}">{{ recipe.homepage }}</a>{% endif %}</td>
+ <td>
+ {% if recipe.homepage_url_only %}
+ <a href="{{ recipe.homepage }}">{{ recipe.homepage }}</a>
+ {% elif recipe.homepage %}
+ {{ recipe.homepage }}
+ {% endif %}
+ </td>
</tr>
{% if recipe.bugtracker %}
<tr>