Commit a51feaa0 authored by Sven Franck's avatar Sven Franck

erp5_corporate_identity: replace is/is not with ==/!=

parent 9a07f26c
...@@ -19,7 +19,7 @@ Save, download or return generated HTML Document ...@@ -19,7 +19,7 @@ Save, download or return generated HTML Document
if doc_save == 1: if doc_save == 1:
web_page_module = getattr(context, 'web_page_module', None) web_page_module = getattr(context, 'web_page_module', None)
if web_page_module is not None: if web_page_module != None:
web_page = web_page_module.newContent( web_page = web_page_module.newContent(
portal_type="Web Page", portal_type="Web Page",
version=doc_version, version=doc_version,
......
"""
================================================================================
Lookup a (hardcoded) custom parameter (default image, css-path etc)
================================================================================
"""
# parameters:
# ------------------------------------------------------------------------------
# parameter Parameter to lookup
customHandler = getattr(context, "WebPage_getCustomParameter", None)
if customHandler is not None:
return customHandler(parameter=parameter)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>parameter=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getCustomTemplateParameter</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -9,6 +9,6 @@ Lookup a (hardcoded) custom parameter (default image, css-path etc) ...@@ -9,6 +9,6 @@ Lookup a (hardcoded) custom parameter (default image, css-path etc)
# override_data Portal Type or relative url passed along # override_data Portal Type or relative url passed along
customProxyHandler = getattr(context, "WebPage_getCustomProxyParameter", None) customProxyHandler = getattr(context, "WebPage_getCustomProxyParameter", None)
if customProxyHandler is not None: if customProxyHandler != None:
source_data = override_data or context.getUid() source_data = override_data or context.getUid()
return customProxyHandler(parameter=parameter, source_data=source_data) return customProxyHandler(parameter=parameter, source_data=source_data)
...@@ -13,7 +13,7 @@ blank = '' ...@@ -13,7 +13,7 @@ blank = ''
# ---------------------------- Set Destination -------------------------------- # ---------------------------- Set Destination --------------------------------
# destination => Web Page = follow-up Organisation or Person, Event # destination => Web Page = follow-up Organisation or Person, Event
if destination is None: if destination == None:
destination_person = None destination_person = None
destination_person_list = [] destination_person_list = []
destination_organisation = None destination_organisation = None
...@@ -21,7 +21,7 @@ if destination is None: ...@@ -21,7 +21,7 @@ if destination is None:
destination_uid = None destination_uid = None
# destination person # destination person
if override_destination_person_title is not None or override_destination_person_title is blank: if override_destination_person_title != None or override_destination_person_title == blank:
destination_person_list = context.Base_getCustomTemplateProxyParameter("override_person", override_destination_person_title) destination_person_list = context.Base_getCustomTemplateProxyParameter("override_person", override_destination_person_title)
if len(destination_person_list) == 0: if len(destination_person_list) == 0:
destination_person_list = context.Base_getCustomTemplateProxyParameter("person", None) destination_person_list = context.Base_getCustomTemplateProxyParameter("person", None)
...@@ -29,11 +29,11 @@ if destination is None: ...@@ -29,11 +29,11 @@ if destination is None:
destination_person = destination_person_list[0] destination_person = destination_person_list[0]
# destination organisation # destination organisation
if override_destination_organisation_title is not None or override_destination_organisation_title is blank: if override_destination_organisation_title != None or override_destination_organisation_title == blank:
destination_organisation_list = context.Base_getCustomTemplateProxyParameter("override_organisation", override_destination_organisation_title) destination_organisation_list = context.Base_getCustomTemplateProxyParameter("override_organisation", override_destination_organisation_title)
if len(destination_organisation_list) == 0: if len(destination_organisation_list) == 0:
destination_organisation_list = context.Base_getCustomTemplateProxyParameter("organisation", None) destination_organisation_list = context.Base_getCustomTemplateProxyParameter("organisation", None)
if len(destination_organisation_list) == 0 and destination_person is not None: if len(destination_organisation_list) == 0 and destination_person != None:
destination_organisation_list = context.Base_getCustomTemplateProxyParameter("source", destination_person.get("uid")) or [] destination_organisation_list = context.Base_getCustomTemplateProxyParameter("source", destination_person.get("uid")) or []
if len(destination_organisation_list) > 0: if len(destination_organisation_list) > 0:
destination_organisation = destination_organisation_list[0] destination_organisation = destination_organisation_list[0]
......
...@@ -9,7 +9,7 @@ Return relevant (predecessor) context if Letter is a subobject ...@@ -9,7 +9,7 @@ Return relevant (predecessor) context if Letter is a subobject
from zExceptions import Unauthorized from zExceptions import Unauthorized
if context_url is not None: if context_url != None:
try: try:
underlying_context = context.restrictedTraverse(context_url) underlying_context = context.restrictedTraverse(context_url)
underlying_portal_type = underlying_context.getPortalType() underlying_portal_type = underlying_context.getPortalType()
......
...@@ -18,7 +18,7 @@ from Products.PythonScripts.standard import html_quote ...@@ -18,7 +18,7 @@ from Products.PythonScripts.standard import html_quote
source_logo_url = None source_logo_url = None
default_bank_account_uid=context.WebPage_getCustomParameter("default_bank_account_uid") default_bank_account_uid=context.WebPage_getCustomParameter("default_bank_account_uid")
if source is None: if source == None:
default_company_title=context.WebPage_getCustomParameter("default_company_title") default_company_title=context.WebPage_getCustomParameter("default_company_title")
contributor_title_string = blank contributor_title_string = blank
source_person = None source_person = None
...@@ -29,7 +29,7 @@ if source is None: ...@@ -29,7 +29,7 @@ if source is None:
source_set = None source_set = None
# source person # source person
if override_source_person_title is not None or override_source_person_title is blank: if override_source_person_title != None or override_source_person_title == blank:
source_person_list = context.Base_getCustomTemplateProxyParameter("override_person", override_source_person_title) source_person_list = context.Base_getCustomTemplateProxyParameter("override_person", override_source_person_title)
if len(source_person_list) == 0: if len(source_person_list) == 0:
source_person_list = context.Base_getCustomTemplateProxyParameter("author", None) or [] source_person_list = context.Base_getCustomTemplateProxyParameter("author", None) or []
...@@ -39,7 +39,7 @@ if source is None: ...@@ -39,7 +39,7 @@ if source is None:
# source organisation # source organisation
# order: override => follow-up => default_organisation_uid => default_company_title => source_person career subordinate # order: override => follow-up => default_organisation_uid => default_company_title => source_person career subordinate
if override_source_organisation_title is not None or override_source_organisation_title is blank: if override_source_organisation_title != None or override_source_organisation_title == blank:
source_organisation_list = context.Base_getCustomTemplateProxyParameter("override_organisation", override_source_organisation_title) source_organisation_list = context.Base_getCustomTemplateProxyParameter("override_organisation", override_source_organisation_title)
if len(source_organisation_list) == 0: if len(source_organisation_list) == 0:
source_organisation_list = context.Base_getCustomTemplateProxyParameter("organisation") source_organisation_list = context.Base_getCustomTemplateProxyParameter("organisation")
...@@ -49,7 +49,7 @@ if source is None: ...@@ -49,7 +49,7 @@ if source is None:
source_organisation_list = context.Base_getCustomTemplateProxyParameter("sender", source_organisation_uid) or [] source_organisation_list = context.Base_getCustomTemplateProxyParameter("sender", source_organisation_uid) or []
if len(source_organisation_list) == 0 and default_company_title: if len(source_organisation_list) == 0 and default_company_title:
source_organisation_list = context.Base_getCustomTemplateProxyParameter("override_organisation", default_company_title) or [] source_organisation_list = context.Base_getCustomTemplateProxyParameter("override_organisation", default_company_title) or []
if len(source_organisation_list) == 0 and source_person is not None: if len(source_organisation_list) == 0 and source_person != None:
for organisation_candidate in source_person_list: for organisation_candidate in source_person_list:
organisation_candidate_list = context.Base_getCustomTemplateProxyParameter("source", organisation_candidate.get("uid")) or [] organisation_candidate_list = context.Base_getCustomTemplateProxyParameter("source", organisation_candidate.get("uid")) or []
if len(organisation_candidate_list) > 0: if len(organisation_candidate_list) > 0:
...@@ -69,7 +69,7 @@ else: ...@@ -69,7 +69,7 @@ else:
source = context.Base_getCustomTemplateProxyParameter("source", source_uid)[0] source = context.Base_getCustomTemplateProxyParameter("source", source_uid)[0]
# override specific bank account (no default to pick correct one if multiple exist) # override specific bank account (no default to pick correct one if multiple exist)
if default_bank_account_uid is not None: if default_bank_account_uid != None:
override_bank_account_list = context.Base_getCustomTemplateProxyParameter("bank", default_bank_account_uid) or [] override_bank_account_list = context.Base_getCustomTemplateProxyParameter("bank", default_bank_account_uid) or []
if len(override_bank_account_list) > 0: if len(override_bank_account_list) > 0:
override_bank_account = override_bank_account_list[0] override_bank_account = override_bank_account_list[0]
...@@ -81,12 +81,12 @@ if default_bank_account_uid is not None: ...@@ -81,12 +81,12 @@ if default_bank_account_uid is not None:
if override_logo_reference: if override_logo_reference:
source_logo_url = html_quote(override_logo_reference) + "?format=png" source_logo_url = html_quote(override_logo_reference) + "?format=png"
source_set = True source_set = True
if source_logo_url is None: if source_logo_url == None:
source_logo_url = source.get("logo_url", blank) source_logo_url = source.get("logo_url", blank)
if source_logo_url is not blank and source_set is None: if source_logo_url != blank and source_set == None:
# XXX: test environment fails if url with parameters are supplied # XXX: test environment fails if url with parameters are supplied
source_logo_url = source_logo_url + "?format=png" source_logo_url = source_logo_url + "?format=png"
if source_logo_url is blank and theme_logo_url is not None: if source_logo_url == blank and theme_logo_url != None:
source_logo_url = theme_logo_url source_logo_url = theme_logo_url
source["enhanced_logo_url"] = source_logo_url source["enhanced_logo_url"] = source_logo_url
......
...@@ -26,7 +26,7 @@ theme = ( ...@@ -26,7 +26,7 @@ theme = (
context.WebPage_getCustomParameter("theme") or context.WebPage_getCustomParameter("theme") or
context.WebPage_getCustomParameter("default_company_title") context.WebPage_getCustomParameter("default_company_title")
) )
if theme is not None: if theme != None:
theme = theme.lower() theme = theme.lower()
theme_logo_prefix = context.WebPage_getCustomParameter("default_logo_prefix") theme_logo_prefix = context.WebPage_getCustomParameter("default_logo_prefix")
if theme_logo_prefix: if theme_logo_prefix:
...@@ -34,14 +34,14 @@ if theme is not None: ...@@ -34,14 +34,14 @@ if theme is not None:
theme_logo_list = context.Base_getCustomTemplateProxyParameter("logo", theme_reference) theme_logo_list = context.Base_getCustomTemplateProxyParameter("logo", theme_reference)
if len(theme_logo_list) > 0: if len(theme_logo_list) > 0:
theme_logo_dict = theme_logo_list[0] theme_logo_dict = theme_logo_list[0]
if theme is None: if theme == None:
theme = "default" theme = "default"
theme_dict = {} theme_dict = {}
theme_dict["theme"] = theme theme_dict["theme"] = theme
theme_dict["theme_logo_description"] = theme_logo_dict.get("description", blank) theme_dict["theme_logo_description"] = theme_logo_dict.get("description", blank)
theme_dict["theme_logo_url"] = context.WebPage_getCustomParameter("fallback_image") theme_dict["theme_logo_url"] = context.WebPage_getCustomParameter("fallback_image")
if theme_logo_dict.get("relative_url", None) is not None: if theme_logo_dict.get("relative_url", None) != None:
theme_dict["theme_logo_url"] = theme_logo_dict.get("relative_url") + param theme_dict["theme_logo_url"] = theme_logo_dict.get("relative_url") + param
theme_dict["template_css_url"] = css_path + pdf + ".css" theme_dict["template_css_url"] = css_path + pdf + ".css"
theme_dict["fallback_img_url"] = context.WebPage_getCustomParameter("fallback_image") or blank theme_dict["fallback_img_url"] = context.WebPage_getCustomParameter("fallback_image") or blank
......
...@@ -32,7 +32,7 @@ Update a book report dialog with parameters manually entered ...@@ -32,7 +32,7 @@ Update a book report dialog with parameters manually entered
# requirement_relative_url XXX sale order has no direct relation to requirement # requirement_relative_url XXX sale order has no direct relation to requirement
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
if dialog_id is not None: if dialog_id != None:
return context.Base_redirect( return context.Base_redirect(
dialog_id, dialog_id,
keep_items = dict( keep_items = dict(
......
...@@ -67,11 +67,11 @@ doc_modification_date = DateTime() ...@@ -67,11 +67,11 @@ doc_modification_date = DateTime()
doc_short_date = doc_modification_date.strftime('%Y-%m-%d') doc_short_date = doc_modification_date.strftime('%Y-%m-%d')
# XXX sigh for passing "" around # XXX sigh for passing "" around
doc_reference = html_quote(override_document_reference) if doc.Base_setToNone(override_document_reference) is not None else doc.Base_setToNone(doc.getReference()) or blank doc_reference = html_quote(override_document_reference) if doc.Base_setToNone(override_document_reference) != None else doc.Base_setToNone(doc.getReference()) or blank
doc_short_title = html_quote(doc_report_title) if doc.Base_setToNone(doc_report_title) is not None else doc.Base_setToNone(doc.getShortTitle()) or blank doc_short_title = html_quote(doc_report_title) if doc.Base_setToNone(doc_report_title) != None else doc.Base_setToNone(doc.getShortTitle()) or blank
doc_version = html_quote(override_document_version) if doc.Base_setToNone(override_document_version) is not None else doc.Base_setToNone(getattr(doc, "version", None)) or "001" doc_version = html_quote(override_document_version) if doc.Base_setToNone(override_document_version) != None else doc.Base_setToNone(getattr(doc, "version", None)) or "001"
doc_title = html_quote(override_document_title) if doc.Base_setToNone(override_document_title) is not None else doc.Base_setToNone(doc.getTitle()) or blank doc_title = html_quote(override_document_title) if doc.Base_setToNone(override_document_title) != None else doc.Base_setToNone(doc.getTitle()) or blank
doc_language = html_quote(override_document_language) if doc.Base_setToNone(override_document_language) is not None else doc.Base_setToNone(doc.getLanguage()) doc_language = html_quote(override_document_language) if doc.Base_setToNone(override_document_language) != None else doc.Base_setToNone(doc.getLanguage())
doc_content = doc_report( doc_content = doc_report(
display_report=True, display_report=True,
...@@ -84,14 +84,14 @@ doc_content = doc_report( ...@@ -84,14 +84,14 @@ doc_content = doc_report(
) )
# test overrides # test overrides
if override_batch_mode is not None: if override_batch_mode != None:
doc_modification_date = DateTime("1976-11-04") doc_modification_date = DateTime("1976-11-04")
doc_revision = "1" doc_revision = "1"
if doc_language is not None: if doc_language != None:
doc.REQUEST['AcceptLanguage'].set(doc_language, 10) doc.REQUEST['AcceptLanguage'].set(doc_language, 10)
if doc_language is None: if doc_language == None:
doc_language = blank doc_language = blank
if doc_reference is blank: if doc_reference == blank:
doc_reference = "Report." + doc_title.replace(" ", ".") doc_reference = "Report." + doc_title.replace(" ", ".")
doc_full_reference = '-'.join([doc_reference, doc_version, doc_language]) doc_full_reference = '-'.join([doc_reference, doc_version, doc_language])
......
...@@ -8,7 +8,7 @@ Create a screenshot from a pdf file ...@@ -8,7 +8,7 @@ Create a screenshot from a pdf file
# frame which page from the pdf file should be captured # frame which page from the pdf file should be captured
# doc_id image on which this screenshot should be saved # doc_id image on which this screenshot should be saved
if doc_id is None: if doc_id == 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."
......
...@@ -56,7 +56,7 @@ Generates the letter Content ...@@ -56,7 +56,7 @@ Generates the letter Content
<tr> <tr>
<td></td> <td></td>
<td class="ci-letter-source"> <td class="ci-letter-source">
<tal:block tal:condition="python: letter_display_source_address is not None"> <tal:block tal:condition="python: letter_display_source_address != None">
<tal:block tal:condition="python: letter_source_company"> <tal:block tal:condition="python: letter_source_company">
<span tal:content="letter_source_company"></span><span class="ci-letter-separator">-</span> <span tal:content="letter_source_company"></span><span class="ci-letter-separator">-</span>
</tal:block> </tal:block>
......
...@@ -55,17 +55,17 @@ Creates the Letter footer section. ...@@ -55,17 +55,17 @@ Creates the Letter footer section.
<div class="ci-letter-footer ci-letter-footer-simple"> <div class="ci-letter-footer ci-letter-footer-simple">
<p class="ci-letter-simple-adress"> <p class="ci-letter-simple-adress">
<span tal:content="python: letter_source_company_corporate_name"></span>&nbsp; <span tal:content="python: letter_source_company_corporate_name"></span>&nbsp;
<tal:block tal:condition="python: letter_source_company_capital is not None"> <tal:block tal:condition="python: letter_source_company_capital != None">
<span i18n:translate="" i18n:domain="erp5_ui">au capital de</span>&nbsp; <span i18n:translate="" i18n:domain="erp5_ui">au capital de</span>&nbsp;
<span tal:content="python: letter_source_company_capital"></span> <span tal:content="python: letter_source_company_capital"></span>
<span tal:content="python: letter_source_company_capital_currency or '&euro;'"></span>, <span tal:content="python: letter_source_company_capital_currency or '&euro;'"></span>,
</tal:block> </tal:block>
<span tal:content="python: ''.join([letter_source_address, ', ', letter_source_postal_code, ' ', letter_source_city])"></span> <span tal:content="python: ''.join([letter_source_address, ', ', letter_source_postal_code, ' ', letter_source_city])"></span>
<br/> <br/>
<tal:block tal:condition="python: letter_source_registered_court is not None"> <tal:block tal:condition="python: letter_source_registered_court != None">
<span tal:content="python: letter_source_registered_court"></span> - <span tal:content="python: letter_source_registered_court"></span> -
</tal:block> </tal:block>
<tal:block tal:condition="python: letter_source_ape_code is not None"> <tal:block tal:condition="python: letter_source_ape_code != None">
<span i18n:translate="" i18n:domain="erp5_ui">APE</span> : <span tal:content="letter_source_ape_code"></span> - <span i18n:translate="" i18n:domain="erp5_ui">APE</span> : <span tal:content="letter_source_ape_code"></span> -
</tal:block> </tal:block>
<span i18n:translate="" i18n:domain="erp5_ui">N° TVA</span> : <span tal:content="python: letter_source_vat"></span> <span i18n:translate="" i18n:domain="erp5_ui">N° TVA</span> : <span tal:content="python: letter_source_vat"></span>
......
...@@ -26,12 +26,6 @@ Print letter in any of the supported formats ...@@ -26,12 +26,6 @@ Print letter in any of the supported formats
# override_destination_person_title: overide event recipient # override_destination_person_title: overide event recipient
# override_date to use instead of current date # override_date to use instead of current date
#new_skin_name = "Letter"
#context.getPortalObject().portal_skins.changeSkin(new_skin_name)
#if REQUEST is None:
# REQUEST = context.REQUEST
#REQUEST.set('portal_skin', new_skin_name)
return context.Letter_viewAsLetter( return context.Letter_viewAsLetter(
format=format, format=format,
display_head=display_head, display_head=display_head,
......
...@@ -58,10 +58,10 @@ Generates the complete book (only called in HTML version) ...@@ -58,10 +58,10 @@ Generates the complete book (only called in HTML version)
</head> </head>
<body class="ci-book" onload="setPlaceholdersWithUrlParameters()"> <body class="ci-book" onload="setPlaceholdersWithUrlParameters()">
<tal:block metal:use-macro="context/WebPage_createBookHeader/macros/book_header" /> <tal:block metal:use-macro="context/WebPage_createBookHeader/macros/book_header" />
<tal:block tal:condition="python: book_raw_report is not True"> <tal:block tal:condition="python: book_raw_report != True">
<tal:block metal:use-macro="context/WebPage_createBookCover/macros/book_cover" /> <tal:block metal:use-macro="context/WebPage_createBookCover/macros/book_cover" />
</tal:block> </tal:block>
<tal:block tal:condition="python: book_include_history is not None"> <tal:block tal:condition="python: book_include_history != None">
<tal:block metal:use-macro="context/WebPage_createBookTableOfHistory/macros/book_history" /> <tal:block metal:use-macro="context/WebPage_createBookTableOfHistory/macros/book_history" />
</tal:block> </tal:block>
<tal:block tal:replace="structure book_table_of_content"></tal:block> <tal:block tal:replace="structure book_table_of_content"></tal:block>
......
...@@ -27,7 +27,7 @@ Creates the Book sections (version, authors, etc). ...@@ -27,7 +27,7 @@ Creates the Book sections (version, authors, etc).
<link rel="stylesheet" tal:attributes="href book_theme_css_url" /> <link rel="stylesheet" tal:attributes="href book_theme_css_url" />
<link rel="stylesheet" tal:attributes="href book_template_css_url" /> <link rel="stylesheet" tal:attributes="href book_template_css_url" />
</head> </head>
<body class="ci-book" tal:condition="python: book_include_history is not None"> <body class="ci-book" tal:condition="python: book_include_history != None">
<tal:block metal:use-macro="context/WebPage_createBookTableOfHistory/macros/book_history" /> <tal:block metal:use-macro="context/WebPage_createBookTableOfHistory/macros/book_history" />
</body> </body>
</html> </html>
...@@ -35,7 +35,7 @@ Creates the Book sections (version, authors, etc). ...@@ -35,7 +35,7 @@ Creates the Book sections (version, authors, etc).
<tal:block tal:condition="python: False"> <tal:block tal:condition="python: False">
<tal:block metal:define-macro="book_history"> <tal:block metal:define-macro="book_history">
<tal:block tal:condition="python: book_include_history is not None"> <tal:block tal:condition="python: book_include_history != None">
<section> <section>
<table class="ci-book-table ci-book-signature-list" border="1" width="100%" cellpadding="0" cellspacing="0"> <table class="ci-book-table ci-book-signature-list" border="1" width="100%" cellpadding="0" cellspacing="0">
<thead> <thead>
......
...@@ -34,7 +34,7 @@ Creates the Tables of references. ...@@ -34,7 +34,7 @@ Creates the Tables of references.
<link rel="stylesheet" tal:attributes="href book_theme_css_url" /> <link rel="stylesheet" tal:attributes="href book_theme_css_url" />
<link rel="stylesheet" tal:attributes="href book_template_css_url" /> <link rel="stylesheet" tal:attributes="href book_template_css_url" />
</head> </head>
<body class="ci-book" tal:condition="python: book_include_reference is not None"> <body class="ci-book" tal:condition="python: book_include_reference != None">
<tal:block metal:use-macro="context/WebPage_createBookTableOfReferences/macros/book_references" /> <tal:block metal:use-macro="context/WebPage_createBookTableOfReferences/macros/book_references" />
</body> </body>
</html> </html>
......
...@@ -46,7 +46,7 @@ for figure in re.findall('(<img.*?/>)', document_content or ''): ...@@ -46,7 +46,7 @@ for figure in re.findall('(<img.*?/>)', document_content or ''):
figure_title[0], figure_title[0],
figure_href[0] figure_href[0]
) )
if figure_doubles.get(figure_title[0], None) is None: if figure_doubles.get(figure_title[0], None) == None:
item_dict = {} item_dict = {}
item_dict["id"] = figure_id item_dict["id"] = figure_id
item_dict["title"] = figure_title[0] item_dict["title"] = figure_title[0]
......
...@@ -44,7 +44,7 @@ Generates the complete leaflet ...@@ -44,7 +44,7 @@ Generates the complete leaflet
</tal:block> </tal:block>
<link rel="stylesheet" tal:attributes="href leaflet_theme_css_url" /> <link rel="stylesheet" tal:attributes="href leaflet_theme_css_url" />
<link rel="stylesheet" tal:attributes="href leaflet_template_css_url" /> <link rel="stylesheet" tal:attributes="href leaflet_template_css_url" />
<tal:block tal:condition="python: leaflet_css is not None"> <tal:block tal:condition="python: leaflet_css != None">
<style type="text/css" tal:content="python: leaflet_css"></style> <style type="text/css" tal:content="python: leaflet_css"></style>
</tal:block> </tal:block>
<script type="text/javascript"> <script type="text/javascript">
......
...@@ -25,7 +25,7 @@ Generate leaflet content ...@@ -25,7 +25,7 @@ Generate leaflet content
</tal:block> </tal:block>
<link rel="stylesheet" tal:attributes="href leaflet_theme_css_url" /> <link rel="stylesheet" tal:attributes="href leaflet_theme_css_url" />
<link rel="stylesheet" tal:attributes="href leaflet_template_css_url" /> <link rel="stylesheet" tal:attributes="href leaflet_template_css_url" />
<tal:block tal:condition="python: leaflet_css is not None"> <tal:block tal:condition="python: leaflet_css != None">
<style type="text/css" tal:content="python: leaflet_css"></style> <style type="text/css" tal:content="python: leaflet_css"></style>
</tal:block> </tal:block>
</head> </head>
......
...@@ -83,7 +83,7 @@ for citation in re.findall(r'\[(.*?)\]', document_content or ''): ...@@ -83,7 +83,7 @@ for citation in re.findall(r'\[(.*?)\]', document_content or ''):
item_dict["number"] = citation_info[1] item_dict["number"] = citation_info[1]
item_dict["version"] = citation_info[2] item_dict["version"] = citation_info[2]
item_dict["href"] = citation_href item_dict["href"] = citation_href
if citation_ad_doubles.get(citation_href, None) is None: if citation_ad_doubles.get(citation_href, None) == None:
citation_ad_doubles[citation_href] = citation_ad_count citation_ad_doubles[citation_href] = citation_ad_count
citation_relevant_count = citation_ad_count citation_relevant_count = citation_ad_count
else: else:
...@@ -101,7 +101,7 @@ for citation in re.findall(r'\[(.*?)\]', document_content or ''): ...@@ -101,7 +101,7 @@ for citation in re.findall(r'\[(.*?)\]', document_content or ''):
item_dict["number"] = citation_info[1] item_dict["number"] = citation_info[1]
item_dict["version"] = citation_info[2] item_dict["version"] = citation_info[2]
item_dict["href"] = citation_href item_dict["href"] = citation_href
if citation_rd_doubles.get(citation_href, None) is None: if citation_rd_doubles.get(citation_href, None) == None:
citation_rd_doubles[citation_href] = citation_rd_count citation_rd_doubles[citation_href] = citation_rd_count
citation_relevant_count = citation_rd_count citation_relevant_count = citation_rd_count
else: else:
...@@ -124,7 +124,7 @@ for citation in re.findall(r'\[(.*?)\]', document_content or ''): ...@@ -124,7 +124,7 @@ for citation in re.findall(r'\[(.*?)\]', document_content or ''):
item_dict["title"] = citation_info[0] item_dict["title"] = citation_info[0]
item_dict["description"] = citation_info[1] item_dict["description"] = citation_info[1]
item_dict["href"] = citation_href item_dict["href"] = citation_href
if citation_ab_doubles.get(citation_href, None) is None: if citation_ab_doubles.get(citation_href, None) == None:
citation_ab_doubles[citation_href] = citation_ab_count citation_ab_doubles[citation_href] = citation_ab_count
citation_relevant_count = citation_ab_count citation_relevant_count = citation_ab_count
else: else:
......
...@@ -28,7 +28,7 @@ match_doubles = {} ...@@ -28,7 +28,7 @@ match_doubles = {}
for caption in re.findall('(<caption.*?>.*?</caption>)', document_content or ''): for caption in re.findall('(<caption.*?>.*?</caption>)', document_content or ''):
caption_title = re.findall('<caption.*?>(.*?)</caption>', caption)[0] caption_title = re.findall('<caption.*?>(.*?)</caption>', caption)[0]
if match_doubles.get(caption_title, None) is None: if match_doubles.get(caption_title, None) == None:
match_doubles[caption_title] = caption_count match_doubles[caption_title] = caption_count
caption_relevant_count = caption_count caption_relevant_count = caption_count
else: else:
......
...@@ -22,7 +22,7 @@ for link in re.findall('([^[]<a.*?</a>[^]])', doc_content or blank): ...@@ -22,7 +22,7 @@ for link in re.findall('([^[]<a.*?</a>[^]])', doc_content or blank):
link_reference = None link_reference = None
# only internal references can be embedded # only internal references can be embedded
if link_reference is not None and link_reference.find("http") == -1: if link_reference != None and link_reference.find("http") == -1:
try: try:
link_doc = context.restrictedTraverse(link_reference.split("?")[0]) link_doc = context.restrictedTraverse(link_reference.split("?")[0])
doc_content = doc_content.replace(link, link_doc.asStrippedHTML()) doc_content = doc_content.replace(link, link_doc.asStrippedHTML())
......
...@@ -24,7 +24,7 @@ def getReportViaFancyName(my_report_name): ...@@ -24,7 +24,7 @@ def getReportViaFancyName(my_report_name):
method_name = ''.join(['Base_render', report_name, 'TextDocumentReportAsHtml']) method_name = ''.join(['Base_render', report_name, 'TextDocumentReportAsHtml'])
method_call = getattr(follow_up, method_name) method_call = getattr(follow_up, method_name)
if method_call is not None: if method_call != None:
# extra curl: Coverage report requires parameter details (1|0) # extra curl: Coverage report requires parameter details (1|0)
if coverage_name: if coverage_name:
...@@ -63,7 +63,7 @@ for link in re.findall('([^[]<a.*?</a>[^]])', doc_content): ...@@ -63,7 +63,7 @@ for link in re.findall('([^[]<a.*?</a>[^]])', doc_content):
if len(link_reference_list) > 0: if len(link_reference_list) > 0:
link_reference = link_reference_list[0] link_reference = link_reference_list[0]
if link_reference is not None and link_reference.find("report=") > -1: if link_reference != None and link_reference.find("report=") > -1:
# url for report, check if report can be found. # url for report, check if report can be found.
report_name = None report_name = None
...@@ -79,11 +79,11 @@ for link in re.findall('([^[]<a.*?</a>[^]])', doc_content): ...@@ -79,11 +79,11 @@ for link in re.findall('([^[]<a.*?</a>[^]])', doc_content):
else: else:
link_param_dict[param_key] = param_value link_param_dict[param_key] = param_value
if report_name is not None: if report_name != None:
target_context = document.restrictedTraverse(link_relative_url, None) target_context = document.restrictedTraverse(link_relative_url, None)
if target_context is not None: if target_context != None:
target_caller = getattr(target_context, report_name, None) target_caller = getattr(target_context, report_name, None)
if target_caller is not None: if target_caller != None:
substitution_content = target_caller(**link_param_dict) substitution_content = target_caller(**link_param_dict)
doc_content = doc_content.replace(link, substitution_content.encode("utf-8").strip()) doc_content = doc_content.replace(link, substitution_content.encode("utf-8").strip())
......
...@@ -19,7 +19,7 @@ Save, download or return generated PDF Document ...@@ -19,7 +19,7 @@ Save, download or return generated PDF Document
if doc_save == 1: if doc_save == 1:
dms_module = getattr(context, 'document_module', None) dms_module = getattr(context, 'document_module', None)
if dms_module is not None: if dms_module != None:
document = dms_module.newContent( document = dms_module.newContent(
portal_type="PDF", portal_type="PDF",
version=doc_version, version=doc_version,
......
...@@ -11,7 +11,7 @@ portal_object = context.getPortalObject() ...@@ -11,7 +11,7 @@ portal_object = context.getPortalObject()
validation_state = ('released', 'released_alive', 'published', 'published_alive', validation_state = ('released', 'released_alive', 'published', 'published_alive',
'shared', 'shared_alive', 'public', 'validated') 'shared', 'shared_alive', 'public', 'validated')
if REQUEST is not None: if REQUEST != None:
return None return None
if portal_type not in portal_type_valid_template_list and portal_type not in portal_type_valid_report_list: if portal_type not in portal_type_valid_template_list and portal_type not in portal_type_valid_report_list:
...@@ -75,7 +75,7 @@ def populatePersonDict(my_person_list): ...@@ -75,7 +75,7 @@ def populatePersonDict(my_person_list):
output_dict["name"] = person.getTitle() or err("title") output_dict["name"] = person.getTitle() or err("title")
output_dict["title"] = person.getFunctionTitle() or err("function title") output_dict["title"] = person.getFunctionTitle() or err("function title")
output_dict["uid"] = person.getUid() or err("uid") output_dict["uid"] = person.getUid() or err("uid")
if person.getDefaultAddress() is not None: if person.getDefaultAddress() != None:
output_dict["address"] = person_address.getStreetAddress() or err("street address") output_dict["address"] = person_address.getStreetAddress() or err("street address")
output_dict["postal_code"] = person_address.getZipCode() or err("postal code") output_dict["postal_code"] = person_address.getZipCode() or err("postal code")
output_dict["city"] = person_address.getCity() or err("city") output_dict["city"] = person_address.getCity() or err("city")
...@@ -83,17 +83,17 @@ def populatePersonDict(my_person_list): ...@@ -83,17 +83,17 @@ def populatePersonDict(my_person_list):
output_dict["address"] = err("street_adress") output_dict["address"] = err("street_adress")
output_dict["postal_code"] = err("postal_code") output_dict["postal_code"] = err("postal_code")
output_dict["city"] = err("city") output_dict["city"] = err("city")
if person_region is not None: if person_region != None:
output_dict["country"] = person_region.getTitle() or err("country") output_dict["country"] = person_region.getTitle() or err("country")
output_dict["codification"] = person_region.getCodification() or err("country code") output_dict["codification"] = person_region.getCodification() or err("country code")
else: else:
output_dict["country"] = err("country") output_dict["country"] = err("country")
output_dict["codification"] = err("country code") output_dict["codification"] = err("country code")
if person_default_telephone is not None: if person_default_telephone != None:
output_dict["phone"] = person_default_telephone.getCoordinateText() or err("phone") output_dict["phone"] = person_default_telephone.getCoordinateText() or err("phone")
else: else:
output_dict["phone"] = err("phone") output_dict["phone"] = err("phone")
if person_default_mail is not None: if person_default_mail != None:
output_dict["email"] = person_default_mail.getUrlString() or err("email") output_dict["email"] = person_default_mail.getUrlString() or err("email")
else: else:
output_dict["email"] = err("email") output_dict["email"] = err("email")
...@@ -119,7 +119,7 @@ def populateOrganisationDict(my_organisation_list): ...@@ -119,7 +119,7 @@ def populateOrganisationDict(my_organisation_list):
output_dict["activity_code"] = organisation.getActivityCode() or err("activitiy code") output_dict["activity_code"] = organisation.getActivityCode() or err("activitiy code")
#output_dict["logo_url"] = organisation.getDefaultImageAbsoluteUrl() or err("logo_url") #output_dict["logo_url"] = organisation.getDefaultImageAbsoluteUrl() or err("logo_url")
if organisation_default_image is not None: if organisation_default_image != None:
output_dict["logo_url"] = organisation_default_image.getRelativeUrl() output_dict["logo_url"] = organisation_default_image.getRelativeUrl()
else: else:
output_dict["logo_url"] = err("logo_url") output_dict["logo_url"] = err("logo_url")
...@@ -131,7 +131,7 @@ def populateOrganisationDict(my_organisation_list): ...@@ -131,7 +131,7 @@ def populateOrganisationDict(my_organisation_list):
output_dict["vat"] = organisation.getVatCode() or err("vat") output_dict["vat"] = organisation.getVatCode() or err("vat")
output_dict["corporate_registration"] = organisation.getCorporateRegistrationCode() or err("corporate_registration") output_dict["corporate_registration"] = organisation.getCorporateRegistrationCode() or err("corporate_registration")
output_dict["email"] = organisation.getDefaultEmailText() or err("email") output_dict["email"] = organisation.getDefaultEmailText() or err("email")
if organisation.getDefaultAddress() is not None: if organisation.getDefaultAddress() != None:
output_dict["address"] = organisation_address.getStreetAddress() or err("street address") output_dict["address"] = organisation_address.getStreetAddress() or err("street address")
output_dict["postal_code"] = organisation_address.getZipCode() or err("postal code") output_dict["postal_code"] = organisation_address.getZipCode() or err("postal code")
output_dict["city"] = organisation_address.getCity() or err("city") output_dict["city"] = organisation_address.getCity() or err("city")
...@@ -139,17 +139,17 @@ def populateOrganisationDict(my_organisation_list): ...@@ -139,17 +139,17 @@ def populateOrganisationDict(my_organisation_list):
output_dict["address"] = err("street address") output_dict["address"] = err("street address")
output_dict["postal_code"] = err("postal code") output_dict["postal_code"] = err("postal code")
output_dict["city"] = err("city") output_dict["city"] = err("city")
if organisation_region is not None: if organisation_region != None:
output_dict["country"] = organisation_region.getTitle() or err("country") output_dict["country"] = organisation_region.getTitle() or err("country")
output_dict["codification"] = organisation_region.getCodification() or err("country code") output_dict["codification"] = organisation_region.getCodification() or err("country code")
else: else:
output_dict["country"] = err("country") output_dict["country"] = err("country")
output_dict["codification"] = err("country code") output_dict["codification"] = err("country code")
if organisation_phone is not None: if organisation_phone != None:
output_dict["phone"] = organisation_phone.getDefaultTelephoneCoordinateText() or err("phone") output_dict["phone"] = organisation_phone.getDefaultTelephoneCoordinateText() or err("phone")
else: else:
output_dict["phone"] = err("phone") output_dict["phone"] = err("phone")
if organisation_fax is not None: if organisation_fax != None:
output_dict["fax"] = organisation_fax.getCoordinateText() or err("fax") output_dict["fax"] = organisation_fax.getCoordinateText() or err("fax")
else: else:
output_dict["fax"] = err("fax") output_dict["fax"] = err("fax")
...@@ -173,7 +173,7 @@ def getSubstringFromProduct(my_candidate, my_as_is): ...@@ -173,7 +173,7 @@ def getSubstringFromProduct(my_candidate, my_as_is):
software_match_string = " Software" software_match_string = " Software"
software_title = my_candidate.get("title") or "" software_title = my_candidate.get("title") or ""
if software_title.find(software_match_string) > 1: if software_title.find(software_match_string) > 1:
if my_as_is is True: if my_as_is == True:
return software_title.split(software_match_string)[0] return software_title.split(software_match_string)[0]
return software_title.split(software_match_string)[0].lower() return software_title.split(software_match_string)[0].lower()
...@@ -188,7 +188,7 @@ pass_parameter = kw.get("parameter", None) ...@@ -188,7 +188,7 @@ pass_parameter = kw.get("parameter", None)
pass_source_data = kw.get("source_data", None) pass_source_data = kw.get("source_data", None)
pass_flag_site = kw.get("flag_site", None) pass_flag_site = kw.get("flag_site", None)
if pass_parameter is not None and pass_source_data is not None: if pass_parameter != None and pass_source_data != None:
# ---------------------- Override Person ------------------------------------- # ---------------------- Override Person -------------------------------------
# returns [{person_dict}] # returns [{person_dict}]
...@@ -230,7 +230,7 @@ if pass_parameter is not None and pass_source_data is not None: ...@@ -230,7 +230,7 @@ if pass_parameter is not None and pass_source_data is not None:
if len(person_candidate_list) > 0: if len(person_candidate_list) > 0:
for c in person_candidate_list: for c in person_candidate_list:
organisation = c.getCareerSubordinationValue() organisation = c.getCareerSubordinationValue()
if organisation is not None: if organisation != None:
return populateOrganisationDict([organisation]) return populateOrganisationDict([organisation])
else: else:
return populatePersonDict([c]) return populatePersonDict([c])
...@@ -283,7 +283,7 @@ if pass_parameter is not None and pass_source_data is not None: ...@@ -283,7 +283,7 @@ if pass_parameter is not None and pass_source_data is not None:
return populateProductDictFromCategoryList( return populateProductDictFromCategoryList(
context.getWebSiteValue().getMembershipCriterionCategoryList() or [] context.getWebSiteValue().getMembershipCriterionCategoryList() or []
) )
elif pass_source_data is not None: elif pass_source_data != None:
return populateProductDict(context.getFollowUpValueList( return populateProductDict(context.getFollowUpValueList(
portal_type=pass_parameter, portal_type=pass_parameter,
checked_permission='View', checked_permission='View',
...@@ -298,7 +298,7 @@ if pass_parameter is not None and pass_source_data is not None: ...@@ -298,7 +298,7 @@ if pass_parameter is not None and pass_source_data is not None:
theme = None theme = None
product_candidate_list = callSelf("product", pass_source_data, pass_flag_site) product_candidate_list = callSelf("product", pass_source_data, pass_flag_site)
if product_candidate_list is not None: if product_candidate_list != None:
if len(product_candidate_list) > 0: if len(product_candidate_list) > 0:
theme = getSubstringFromProduct(product_candidate_list[0], None) theme = getSubstringFromProduct(product_candidate_list[0], None)
......
...@@ -37,7 +37,7 @@ Update a book dialog with parameters manually entered ...@@ -37,7 +37,7 @@ Update a book dialog with parameters manually entered
# display_svg format for svg images (svg, png*) # display_svg format for svg images (svg, png*)
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
if dialog_id is not None: if dialog_id != None:
return context.Base_redirect( return context.Base_redirect(
dialog_id, dialog_id,
keep_items = dict( keep_items = dict(
......
...@@ -23,7 +23,7 @@ Update a leaflet dialog with parameters manually entered ...@@ -23,7 +23,7 @@ Update a leaflet dialog with parameters manually entered
# document_save: save file in document module # document_save: save file in document module
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
if dialog_id is not None: if dialog_id != None:
return context.Base_redirect( return context.Base_redirect(
dialog_id, dialog_id,
keep_items = dict( keep_items = dict(
......
...@@ -28,7 +28,7 @@ Update the letter dialog with parameters manually entered ...@@ -28,7 +28,7 @@ Update the letter dialog with parameters manually entered
# override_date to use instead of current date # override_date to use instead of current date
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
if dialog_id is not None: if dialog_id != None:
return context.Base_redirect( return context.Base_redirect(
dialog_id, dialog_id,
keep_items = dict( keep_items = dict(
......
...@@ -26,7 +26,7 @@ Update the slide dialog with parameters manually entered ...@@ -26,7 +26,7 @@ Update the slide dialog with parameters manually entered
# display_svg: display svg-images as svg or png* # display_svg: display svg-images as svg or png*
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
if dialog_id is not None: if dialog_id != None:
return context.Base_redirect( return context.Base_redirect(
dialog_id, dialog_id,
keep_items = dict( keep_items = dict(
......
...@@ -13,7 +13,7 @@ Upgrade image for the specific type of display ...@@ -13,7 +13,7 @@ Upgrade image for the specific type of display
import re import re
if img_string is None or img_string == "": if img_string == None or img_string == "":
return img_string return img_string
img_src = re.findall("src=['\"](.*?)['\"]", img_string)[0] img_src = re.findall("src=['\"](.*?)['\"]", img_string)[0]
......
...@@ -51,7 +51,7 @@ book_save = book.Base_setToNone(param=kw.get('document_save', None)) ...@@ -51,7 +51,7 @@ book_save = book.Base_setToNone(param=kw.get('document_save', None))
book_display_svg = book.Base_setToNone(param=kw.get('display_svg', None)) book_display_svg = book.Base_setToNone(param=kw.get('display_svg', None))
book_include_content_table = kw.get('include_content_table', None) book_include_content_table = kw.get('include_content_table', None)
if book_include_content_table is None: if book_include_content_table == None:
book_include_content_table = 1 book_include_content_table = 1
else: else:
book_include_content_table = book.Base_setToNone(param=book_include_content_table) book_include_content_table = book.Base_setToNone(param=book_include_content_table)
...@@ -83,23 +83,23 @@ book_modification_date = book.getModificationDate() ...@@ -83,23 +83,23 @@ book_modification_date = book.getModificationDate()
book_language = book.Base_setToNone(param=book.getLanguage()) book_language = book.Base_setToNone(param=book.getLanguage())
# XXX sigh for passing "" around # XXX sigh for passing "" around
book_reference = html_quote(override_document_reference) if book.Base_setToNone(override_document_reference) is not None else book.Base_setToNone(book.getReference()) book_reference = html_quote(override_document_reference) if book.Base_setToNone(override_document_reference) != None else book.Base_setToNone(book.getReference())
book_short_title = html_quote(override_document_short_title) if book.Base_setToNone(override_document_short_title) is not None else book.Base_setToNone(book.getShortTitle()) book_short_title = html_quote(override_document_short_title) if book.Base_setToNone(override_document_short_title) != None else book.Base_setToNone(book.getShortTitle())
book_version = html_quote(override_document_version) if book.Base_setToNone(override_document_version) is not None else book.Base_setToNone(book.getVersion()) or "001" book_version = html_quote(override_document_version) if book.Base_setToNone(override_document_version) != None else book.Base_setToNone(book.getVersion()) or "001"
book_description = html_quote(override_document_description) if book.Base_setToNone(override_document_description) is not None else book.Base_setToNone(book.getDescription()) book_description = html_quote(override_document_description) if book.Base_setToNone(override_document_description) != None else book.Base_setToNone(book.getDescription())
book_title = html_quote(override_document_title) if book.Base_setToNone(override_document_title) is not None else book.Base_setToNone(book.getTitle()) book_title = html_quote(override_document_title) if book.Base_setToNone(override_document_title) != None else book.Base_setToNone(book.getTitle())
# override for tests # override for tests
if override_batch_mode is not None: if override_batch_mode != None:
book_modification_date = DateTime("1976-11-04") book_modification_date = DateTime("1976-11-04")
book_revision = "1" book_revision = "1"
book_short_date = book_modification_date.strftime('%Y-%m-%d') book_short_date = book_modification_date.strftime('%Y-%m-%d')
if book_language is not None: if book_language != None:
book.REQUEST['AcceptLanguage'].set(book_language, 10) book.REQUEST['AcceptLanguage'].set(book_language, 10)
if book_language is None: if book_language == None:
book_language = blank book_language = blank
if book_reference is None: if book_reference == None:
book_reference = book_prefix + book_title.replace(" ", ".") book_reference = book_prefix + book_title.replace(" ", ".")
book_full_reference = '-'.join([book_reference, book_version, book_language]) book_full_reference = '-'.join([book_reference, book_version, book_language])
...@@ -129,21 +129,21 @@ book_table_of_content = blank ...@@ -129,21 +129,21 @@ book_table_of_content = blank
book_content.replace("${WebPage_insertTableOfReferences}", blank) book_content.replace("${WebPage_insertTableOfReferences}", blank)
# XXX: not done # XXX: not done
if book_include_history_table is not None: if book_include_history_table != None:
book_signature_list = [] book_signature_list = []
book_version_list = [] book_version_list = []
book_distribution_list = [] book_distribution_list = []
# old generate book # old generate book
if book_include_linked_content is not None: if book_include_linked_content != None:
book_content = book.WebPage_embedLinkedDocumentList(doc_content=book_content) book_content = book.WebPage_embedLinkedDocumentList(doc_content=book_content)
# embed reports # embed reports
if book_include_report_content is not None: if book_include_report_content != None:
book_content = book.WebPage_embedReportDocumentList(doc_content=book_content) book_content = book.WebPage_embedReportDocumentList(doc_content=book_content)
# table of links # table of links
if book_include_reference_table is not None: if book_include_reference_table != None:
book_link_list = book.WebPage_createLinkOverview(book_content) book_link_list = book.WebPage_createLinkOverview(book_content)
table_link_list = book.WebPage_createTableOverview(book_content) table_link_list = book.WebPage_createTableOverview(book_content)
image_link_list = book.WebPage_createImageOverview(book_content) image_link_list = book.WebPage_createImageOverview(book_content)
...@@ -185,7 +185,7 @@ if book_include_reference_table is not None: ...@@ -185,7 +185,7 @@ if book_include_reference_table is not None:
# table of content has to be created manually to run over everything that # table of content has to be created manually to run over everything that
# should be indexed in the toc # should be indexed in the toc
if book_include_content_table is not None: if book_include_content_table != None:
book_translated_toc_title = translateText("Table of Contents") book_translated_toc_title = translateText("Table of Contents")
if book_format == "pdf": if book_format == "pdf":
book_table_of_content = book.WebPage_createBookXslTableOfContent( book_table_of_content = book.WebPage_createBookXslTableOfContent(
...@@ -332,11 +332,11 @@ if book_format == "pdf": ...@@ -332,11 +332,11 @@ if book_format == "pdf":
b64encode(book.Base_convertHtmlToSingleFile(book_cover, allow_script=True)), b64encode(book.Base_convertHtmlToSingleFile(book_cover, allow_script=True)),
] ]
after_toc_data_list = [] after_toc_data_list = []
if book_include_history_table is not None: if book_include_history_table != None:
before_toc_data_list.append( before_toc_data_list.append(
b64encode(book.Base_convertHtmlToSingleFile(book_history, allow_script=True)) b64encode(book.Base_convertHtmlToSingleFile(book_history, allow_script=True))
) )
if book_include_reference_table is not None: if book_include_reference_table != None:
after_toc_data_list.append( after_toc_data_list.append(
b64encode(book.Base_convertHtmlToSingleFile(book_references, allow_script=True)) b64encode(book.Base_convertHtmlToSingleFile(book_references, allow_script=True))
) )
...@@ -348,7 +348,7 @@ if book_format == "pdf": ...@@ -348,7 +348,7 @@ if book_format == "pdf":
encoding="utf8", encoding="utf8",
margin_top=40, margin_top=40,
margin_bottom=20, margin_bottom=20,
toc=True if book_include_content_table is not None else False, toc=True if book_include_content_table != None else False,
before_toc_data_list=before_toc_data_list, before_toc_data_list=before_toc_data_list,
xsl_style_sheet_data=b64encode(xsl_style_sheet_data), xsl_style_sheet_data=b64encode(xsl_style_sheet_data),
after_toc_data_list=after_toc_data_list, after_toc_data_list=after_toc_data_list,
......
...@@ -66,14 +66,14 @@ leaflet_aggregate_list = [] ...@@ -66,14 +66,14 @@ leaflet_aggregate_list = []
leaflet_modification_date = leaflet.getModificationDate() leaflet_modification_date = leaflet.getModificationDate()
# test overrides # test overrides
if override_batch_mode is not None: if override_batch_mode != None:
leaflet_date="Nov-1976" leaflet_date="Nov-1976"
leaflet_year="1976" leaflet_year="1976"
if leaflet_language is not None: #and leaflet_format == "pdf": if leaflet_language != None: #and leaflet_format == "pdf":
leaflet.REQUEST['AcceptLanguage'].set(leaflet_language, 10) leaflet.REQUEST['AcceptLanguage'].set(leaflet_language, 10)
if leaflet_language is None: if leaflet_language == None:
leaflet_language = blank leaflet_language = blank
if leaflet_reference is None: if leaflet_reference == None:
leaflet_reference = leaflet_prefix + leaflet_title.replace(" ", ".") leaflet_reference = leaflet_prefix + leaflet_title.replace(" ", ".")
leaflet_full_reference = '-'.join([leaflet_reference, leaflet_version, leaflet_language]) leaflet_full_reference = '-'.join([leaflet_reference, leaflet_version, leaflet_language])
...@@ -81,7 +81,7 @@ leaflet_full_reference = '-'.join([leaflet_reference, leaflet_version, leaflet_l ...@@ -81,7 +81,7 @@ leaflet_full_reference = '-'.join([leaflet_reference, leaflet_version, leaflet_l
leaflet_theme = leaflet.Base_getThemeDict(doc_format=leaflet_format, css_path="template_css/leaflet") leaflet_theme = leaflet.Base_getThemeDict(doc_format=leaflet_format, css_path="template_css/leaflet")
# XXX set leaflet title, but not to theme (used elsewhere, but not on leaflet) # XXX 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 != 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(): if leaflet_theme.get("theme").lower() == leaflet_theme.get("theme_logo_description").lower():
leaflet_theme["theme_logo_description"] = blank leaflet_theme["theme_logo_description"] = blank
......
...@@ -45,7 +45,7 @@ def getNestedSection(my_content): ...@@ -45,7 +45,7 @@ def getNestedSection(my_content):
def removeSlidesWithoutDetailsFromNotes(my_content): def removeSlidesWithoutDetailsFromNotes(my_content):
slide_list = getSlideList(my_content) slide_list = getSlideList(my_content)
for slide in slide_list: for slide in slide_list:
if getNestedSection(slide) is False: if getNestedSection(slide) == False:
my_content = my_content.replace(slide, blank) my_content = my_content.replace(slide, blank)
content = my_content.replace('<section></section>', blank) content = my_content.replace('<section></section>', blank)
content = re.sub(r'<section class="[^"]*"></section>', blank, content) content = re.sub(r'<section class="[^"]*"></section>', blank, content)
...@@ -118,9 +118,9 @@ def sortContent(my_page_list): ...@@ -118,9 +118,9 @@ def sortContent(my_page_list):
if page_content.find("<center>") > -1: if page_content.find("<center>") > -1:
page_tuple_first = (page_title, page_content, "first") page_tuple_first = (page_title, page_content, "first")
sort_content_list = sorted(page_content_list, key=lambda page_foo: page_foo[0]) sort_content_list = sorted(page_content_list, key=lambda page_foo: page_foo[0])
if page_tuple_last is not None: if page_tuple_last != None:
sort_content_list.append(page_tuple_last) sort_content_list.append(page_tuple_last)
if page_tuple_first is not None: if page_tuple_first != None:
sort_content_list = [page_tuple_first] + sort_content_list sort_content_list = [page_tuple_first] + sort_content_list
return sort_content_list return sort_content_list
...@@ -145,7 +145,7 @@ override_source_person_title = None ...@@ -145,7 +145,7 @@ override_source_person_title = None
# ---------- backward compatability with legacy odp/sxi presentations ---------- # ---------- backward compatability with legacy odp/sxi presentations ----------
# note: this has to come first to convert file into html and then continue # note: this has to come first to convert file into html and then continue
if doc_ooo is not None: if doc_ooo != None:
doc_portal = doc.getPortalObject() doc_portal = doc.getPortalObject()
if doc.getPortalType() in ["Presentation"]: if doc.getPortalType() in ["Presentation"]:
raw_data = doc_portal.portal_transforms.convertToData( raw_data = doc_portal.portal_transforms.convertToData(
...@@ -154,7 +154,7 @@ if doc_ooo is not None: ...@@ -154,7 +154,7 @@ if doc_ooo is not None:
context=context, context=context,
mimetype=doc.getContentType() mimetype=doc.getContentType()
) )
if raw_data is None: if raw_data == None:
raise ValueError("Failed to convert to %r" % "text/html") raise ValueError("Failed to convert to %r" % "text/html")
# got something # got something
...@@ -188,14 +188,14 @@ doc_relative_url = doc.getRelativeUrl() ...@@ -188,14 +188,14 @@ doc_relative_url = doc.getRelativeUrl()
doc_aggregate_list = [] doc_aggregate_list = []
doc_modification_date = doc.getModificationDate() doc_modification_date = doc.getModificationDate()
if override_batch_mode is not None: if override_batch_mode != None:
doc_version = "001" doc_version = "001"
doc_creation_year = "1976" doc_creation_year = "1976"
if doc_language is not None: #and doc_format == "pdf": if doc_language != None: #and doc_format == "pdf":
doc.REQUEST['AcceptLanguage'].set(doc_language, 10) doc.REQUEST['AcceptLanguage'].set(doc_language, 10)
if doc_language is None: if doc_language == None:
doc_language = blank doc_language = blank
if doc_reference is None: if doc_reference == None:
doc_reference = doc_prefix + doc_title.replace(" ", ".") doc_reference = doc_prefix + doc_title.replace(" ", ".")
doc_full_reference = '-'.join([doc_reference, doc_version, doc_language]) doc_full_reference = '-'.join([doc_reference, doc_version, doc_language])
......
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