Commit 6b343fc6 authored by Sven Franck's avatar Sven Franck

erp5_corporate_identity: add back previously corrupt pdf, fixes for tests

parent e5e197df
...@@ -2,7 +2,7 @@ if id is None: ...@@ -2,7 +2,7 @@ if id is None:
return "Failed. Missing image id." return "Failed. Missing image id."
if context.getPortalType() != "PDF": if context.getPortalType() != "PDF":
return "Failed. Not a pdf." return "Failed. Not a pdf."
if context.getId().find("template_test") == -1: if context.getId().find("template_") == -1:
return "Failed. Not a template test item." return "Failed. Not a template test item."
pdf_page = context pdf_page = context
......
...@@ -34,6 +34,11 @@ citation_ad_doubles = {} ...@@ -34,6 +34,11 @@ citation_ad_doubles = {}
citation_rd_doubles = {} citation_rd_doubles = {}
for citation in re.findall('\[(.*?)\]', document_content or ''): for citation in re.findall('\[(.*?)\]', document_content or ''):
# disregard empty brackets
if citation == blank:
continue
citation_href = (re.findall(match_href, citation) or [""])[0] citation_href = (re.findall(match_href, citation) or [""])[0]
# RD = Referenced Document / AD = Applicable Document # RD = Referenced Document / AD = Applicable Document
......
...@@ -84,7 +84,7 @@ leaflet_display_svg = setToNone(kw.get('display_svg', "png")) ...@@ -84,7 +84,7 @@ leaflet_display_svg = setToNone(kw.get('display_svg', "png"))
leaflet_download = setToNone(kw.get('document_download', None)) leaflet_download = setToNone(kw.get('document_download', None))
leaflet_save = setToNone(kw.get('document_save', None)) leaflet_save = setToNone(kw.get('document_save', None))
override_leaflet_header_title = kw.get('override_leaflet_header_title', None) override_leaflet_header_title = setToNone(kw.get('override_leaflet_header_title', None))
override_source_person_title = kw.get('override_source_person_title', None) override_source_person_title = kw.get('override_source_person_title', None)
override_source_organisation_title = kw.get( override_source_organisation_title = kw.get(
"override_source_organisation_title", "override_source_organisation_title",
...@@ -126,8 +126,11 @@ leaflet_theme = leaflet.Base_getThemeDict( ...@@ -126,8 +126,11 @@ leaflet_theme = leaflet.Base_getThemeDict(
url=leaflet_url, url=leaflet_url,
css_path="/leaflet_css/leaflet" css_path="/leaflet_css/leaflet"
) )
# set leaflet title, but not to theme (used elsewhere, but not on leaflet)
if override_leaflet_header_title is not None: if override_leaflet_header_title is not None:
leaflet_theme["theme_logo_description"] = html_quote(override_leaflet_header_title) leaflet_theme["theme_logo_description"] = html_quote(override_leaflet_header_title)
if leaflet_theme.get("theme").lower() == leaflet_theme.get("theme_logo_description").lower():
leaflet_theme["theme_logo_description"] = blank
leaflet_recycle_url = ''.join([leaflet_url, "/leaflet_img/recycle.png?portal_skin=Leaflet"]) leaflet_recycle_url = ''.join([leaflet_url, "/leaflet_img/recycle.png?portal_skin=Leaflet"])
leaflet_css = ''.join([ leaflet_css = ''.join([
'html .ci-leaflet #left-summary:before {', 'html .ci-leaflet #left-summary:before {',
......
...@@ -230,7 +230,7 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase): ...@@ -230,7 +230,7 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
""" """
test_page = getattr(self.portal.web_page_module, id1) test_page = getattr(self.portal.web_page_module, id1)
expected_page = getattr(self.portal.web_page_module, id2) expected_page = getattr(self.portal.web_page_module, id2)
dump = getattr(self.portal, 'dump_data') dump = getattr(self.portal, 'dump_data', None)
kw["override_date"] = kw.get("override_date", test_page.getModificationDate()) kw["override_date"] = kw.get("override_date", test_page.getModificationDate())
html = getattr(test_page, kw.get("test_method"))(portal_skin=kw.get("use_skin"), **kw) html = getattr(test_page, kw.get("test_method"))(portal_skin=kw.get("use_skin"), **kw)
...@@ -248,7 +248,7 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase): ...@@ -248,7 +248,7 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
test_page = getattr(self.portal.web_page_module, id1) test_page = getattr(self.portal.web_page_module, id1)
expected_image = getattr(self.portal.image_module, id2) expected_image = getattr(self.portal.image_module, id2)
image_source_pdf_doc = getattr(self.portal.document_module, id3) image_source_pdf_doc = getattr(self.portal.document_module, id3)
dump = getattr(self.portal, 'dump_data') dump = getattr(self.portal, 'dump_data', None)
kw["override_date"] = kw.get("override_date", test_page.getModificationDate()) kw["override_date"] = kw.get("override_date", test_page.getModificationDate())
pdf_kw = dict( pdf_kw = dict(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment