[#8356] comparison type errors
diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html
index 9114986..3c19984 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -216,10 +216,11 @@
#}
{%- macro project_icon_srcs(project, icon_url=None, base_size=48) %}
{% set icon_url = icon_url or project.url() + 'icon' %}
- src="{{icon_url}}?{{project.icon_timestamp}}{% if base_size != 48 and project.icon_max_size >= base_size %}&w={{base_size}}{% endif %}"
- {% if project.icon_max_size >= base_size*1.5 -%}
+ {% set proj_max_size = project.icon_max_size or 0 %}
+ src="{{icon_url}}?{{project.icon_timestamp}}{% if base_size != 48 and proj_max_size >= base_size %}&w={{base_size}}{% endif %}"
+ {% if proj_max_size >= base_size*1.5 -%}
srcset="{{icon_url}}?w={{ (base_size*1.5)|int }}&{{project.icon_timestamp}} 1.5x
- {% if project.icon_max_size >= base_size*2 -%},
+ {% if proj_max_size >= base_size*2 -%},
{{icon_url}}?w={{ base_size*2 }}&{{project.icon_timestamp}} 2x
{%- endif -%}
"
diff --git a/Allura/allura/tests/test_plugin.py b/Allura/allura/tests/test_plugin.py
index ce23474..e615b74 100644
--- a/Allura/allura/tests/test_plugin.py
+++ b/Allura/allura/tests/test_plugin.py
@@ -417,6 +417,7 @@
note.user_role = 'Test'
note.page_regex = None
note.page_tool_type = None
+ note.impressions = 10
SiteNotification.actives.return_value = [note]
projects = c.user.my_projects_by_role_name
@@ -446,6 +447,7 @@
note.user_role = None
note.page_regex = None
note.page_tool_type = None
+ note.impressions = 10
SiteNotification.actives.return_value = [note]
assert_is(ThemeProvider().get_site_notification(), note)
@@ -459,6 +461,7 @@
note.user_role = None
note.page_regex = 'test'
note.page_tool_type = None
+ note.impressions = 10
SiteNotification.actives.return_value = [note]
search.return_value = True
@@ -476,6 +479,7 @@
note.user_role = None
note.page_regex = None
note.page_tool_type.lower.return_value = 'test1'
+ note.impressions = 10
SiteNotification.actives.return_value = [note]
c.app = Mock()
c.app.config.tool_name.lower.return_value = 'test1'
@@ -496,6 +500,7 @@
note.user_role = None
note.page_regex = 'test'
note.page_tool_type.lower.return_value = 'test1'
+ note.impressions = 10
SiteNotification.actives.return_value = [note]
c.app = Mock()
@@ -526,6 +531,7 @@
note.user_role = None
note.page_regex = None
note.page_tool_type = None
+ note.impressions = 10
SiteNotification.actives.return_value = [note]
get_note = ThemeProvider()._get_site_notification()
@@ -541,16 +547,19 @@
note1.user_role = None
note1.page_regex = 'this-will-not-match'
note1.page_tool_type = None
+ note1.impressions = 10
note2 = MagicMock(name='note2')
note2._id = 'test2'
note2.user_role = None
note2.page_regex = None
note2.page_tool_type = None
+ note2.impressions = 10
note3 = MagicMock(name='note3')
note3._id = 'test3'
note3.user_role = None
note3.page_regex = None
note3.page_tool_type = None
+ note3.impressions = 10
SiteNotification.actives.return_value = [note1, note2, note3]
get_note = ThemeProvider()._get_site_notification()
@@ -576,6 +585,7 @@
note.user_role = None
note.page_regex = None
note.page_tool_type = None
+ note.impressions = 10
SiteNotification.actives.return_value = [note]
get_note = ThemeProvider()._get_site_notification(
site_notification_cookie_value='testid-1-False'