Skip to content

Commit

Permalink
lint fixes and removed mark_down method
Browse files Browse the repository at this point in the history
  • Loading branch information
depsiatwal committed Oct 30, 2024
1 parent 31a862b commit 7315a8e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 37 deletions.
12 changes: 8 additions & 4 deletions exporter/apply_for_a_licence/forms/trade_control_licence.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def application_type_form():
Option(
key=CaseTypes.OGTCL,
value=TradeControlLicenceQuestions.TradeControlLicenceQuestion.OPEN_GENERAL_TRADE_CONTROL_LICENCE,
description="""Select to register a pre-published licence with set terms and conditions. Being an OGTCL holder can benefit your
business by saving time and money.""",
description="""Select to register a pre-published licence with set terms and conditions.
Being an OGTCL holder can benefit your business by saving time and money.""",
),
Option(
key=CaseTypes.SICL,
Expand All @@ -30,7 +30,7 @@ def application_type_form():
key=CaseTypes.OICL,
value=TradeControlLicenceQuestions.TradeControlLicenceQuestion.OPEN_LICENCE,
description="""Select an open licence for multiple shipments of specific products to specific destinations.
Open licences cover long term projects and repeat business.""",
Open licences cover long term projects and repeat business.""",
),
],
)
Expand Down Expand Up @@ -77,7 +77,11 @@ def product_category_form(request):
"category_b": TradeControlLicenceQuestions.ProductCategory.CATEGORY_B_HINT,
"category_c": TradeControlLicenceQuestions.ProductCategory.CATEGORY_C_HINT,
}
PRODUCT_CATEGORY_DESCRIPTION = """Find out about <a class="govuk-link govuk-link--no-visited-state" rel="noreferrer noopener" target="_blank" href="https://www.gov.uk/guidance/export-controls-military-goods-software-and-technology#trade-controls-and-arranging-sales-or-movements">trade control product categories</a>."""
guidence_url = "https://www.gov.uk/guidance/export-controls-military-goods-software-and-technology#trade-controls-and-arranging-sales-or-movements"
PRODUCT_CATEGORY_DESCRIPTION = f"""Find out about <a class="govuk-link govuk-link--no-visited-state"
rel="noreferrer noopener" target="_blank"
href="{guidence_url}">
trade control product categories</a>."""

options = [
Option(product_category["key"], product_category["value"], hint_text_map.get(product_category["key"]))
Expand Down
9 changes: 6 additions & 3 deletions exporter/compliance/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def get_years():

def open_licence_return_form_group():
FORMATTING_HELP_DETAILS = """
The first row must contain column headers, or be blank. It must not contain returns data.<br>Columns must start from column A and be in the following order:<br><ul>
The first row must contain column headers, or be blank.
It must not contain returns data.<br>Columns must start from column A and be in the following order:<br><ul>
<li>Licence number</li>
<li>Destination</li>
<li>End user type</li>
Expand All @@ -22,12 +23,14 @@ def open_licence_return_form_group():
</ul><br>Licence number must be in one of the following formats:<br><ul>
<li>GBOXX20XX/XXXXX. For example GBOIE2020/00001)</li>
<li>GBOXX20XX/XXXXX/X for amended licences. For example GBOIE2020/00001/A</li>
</ul><br>Destination names must be entered exactly as they appear on the licence.<br><br>End user type must be one of the following, entered exactly as shown here:<br><ul>
</ul><br>Destination names must be entered exactly as they appear on the licence.
<br><br>End user type must be one of the following, entered exactly as shown here:<br><ul>
<li>Government</li>
<li>Commercial</li>
<li>Pvt Indiv</li>
<li>Other</li>
</ul><br>Usage count must be a positive integer.<br><br>Period must be in the following format, entered exactly as shown with YY replaced with the last 2 digits of the year:<br><ul>
</ul><br>Usage count must be a positive integer.
<br><br>Period must be in the following format, entered exactly as shown with YY replaced with the last 2 digits of the year:<br><ul>
<li>01-JAN-YY to 31-DEC-YY</li>
</ul>
"""
Expand Down
12 changes: 8 additions & 4 deletions exporter/goods/forms/goods.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
TextArea,
TextInput,
)
from lite_forms.helpers import convert_to_markdown
from lite_forms.styles import ButtonStyle, HeadingStyle


Expand Down Expand Up @@ -149,7 +148,9 @@ def edit_good_detail_form(request, good_id):


def check_document_available_form(back_url):
DESCRIPTION = """For example, a technical specification, datasheet, sales brochure or something else that fully describes the product details.<br /> This is required in order to process the application."""
DESCRIPTION = """For example, a technical specification, datasheet,
sales brochure or something else that fully describes the product details.
<br /> This is required in order to process the application."""

return Form(
title=DocumentAvailabilityForm.TITLE,
Expand Down Expand Up @@ -204,7 +205,10 @@ def document_grading_form(back_url):


def attach_documents_form(back_link):
DESCRIPTION = """Upload a DOCX, DOC, PDF, PNG, JPEG or ODT file.<br>Documentation could be specifications, datasheets, sales brochures, drawings or anything else that fully details what the product is and what it's designed to do.<br>Do not attach a document that’s above OFFICIAL-SENSITIVE.<br>The file must be smaller than 50MB."""
DESCRIPTION = """Upload a DOCX, DOC, PDF, PNG, JPEG or ODT file.
<br>Documentation could be specifications, datasheets,
sales brochures, drawings or anything else that fully details what the product is and what it's designed to do.
<br>Do not attach a document that’s above OFFICIAL-SENSITIVE.<br>The file must be smaller than 50MB."""

return Form(
title=AttachDocumentForm.TITLE,
Expand Down Expand Up @@ -810,7 +814,7 @@ class AddGoodsQuestionsForm(forms.Form):
(False, CreateGoodForm.IsControlled.NO),
),
label=CreateGoodForm.IsControlled.TITLE,
help_text=convert_to_markdown(CreateGoodForm.IsControlled.DESCRIPTION),
help_text=CreateGoodForm.IsControlled.DESCRIPTION,
)

control_list_entries = forms.MultipleChoiceField(
Expand Down
27 changes: 16 additions & 11 deletions lite_content/lite_exporter_frontend/goods.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,12 @@ class DocumentAvailabilityForm:

class DocumentSensitivityForm:
TITLE = "Is the document rated above OFFICIAL-SENSITIVE?"
ECJU_HELPLINE = """<strong><noscript>If the answer is No;</noscript></strong><br>Contact ECJU to arrange a more secure way to send this document.<br>You can continue with the application without attaching a document.<br><strong>ECJU helpline</strong><br />
020 7215 4594<br /> <a class="govuk-link govuk-link--no-visited-state" rel="noreferrer noopener" target="_blank" href="https://www.gov.uk/call-charges">Find out about call charges (opens in new tab)</a>
"""
ECJU_HELPLINE = """<strong><noscript>If the answer is No;</noscript></strong>
<br>Contact ECJU to arrange a more secure way to send this document.
<br>You can continue with the application without attaching a document.
<br><strong>ECJU helpline</strong><br />020 7215 4594<br />
<a class="govuk-link govuk-link--no-visited-state" rel="noreferrer noopener" target="_blank" href="https://www.gov.uk/call-charges">
Find out about call charges (opens in new tab)</a>"""
SUBMIT_BUTTON = "Save and continue"

class Options:
Expand All @@ -140,14 +143,16 @@ class Description:

class IsControlled:
TITLE = "Is the product on the control list?"
DESCRIPTION = (
"Products that aren't on the " + PERMISSION_FINDER_LINK + " may be affected by [military end use controls]"
"(https://www.gov.uk/guidance/export-controls-military-goods-software-and-technology), "
"[current trade sanctions and embargoes]"
"(https://www.gov.uk/guidance/current-arms-embargoes-and-other-restrictions) or "
"[weapons of mass destruction controls](https://www.gov.uk/guidance/supplementary-wmd-end-use-controls). "
"If the product isn't subject to any controls, you'll get a no licence required (NLR) document from ECJU."
)
DESCRIPTION = """Products that aren't on the <a class="govuk-link govuk-link--no-visited-state"
rel="noreferrer noopener" target="_blank" href="">control list</a>
may be affected by <a class="govuk-link govuk-link--no-visited-state"
rel="noreferrer noopener" target="_blank" href="https://www.gov.uk/guidance/export-controls-military-goods-software-and-technology">
military end use controls</a>, <a class="govuk-link govuk-link--no-visited-state" rel="noreferrer noopener"
target="_blank" href="https://www.gov.uk/guidance/current-arms-embargoes-and-other-restrictions">
current trade sanctions and embargoes</a> or <a class="govuk-link govuk-link--no-visited-state"
rel="noreferrer noopener" target="_blank" href="https://www.gov.uk/guidance/supplementary-wmd-end-use-controls">
weapons of mass destruction controls</a>. If the product isn't subject to any controls,
you'll get a no licence required (NLR) document from ECJU."""
CLC_REQUIRED = (
"Products that aren't on the " + PERMISSION_FINDER_LINK + " may be affected by [military end use controls]"
"(https://www.gov.uk/guidance/export-controls-military-goods-software-and-technology), "
Expand Down
15 changes: 0 additions & 15 deletions lite_forms/helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import copy
from collections.abc import MutableMapping

from markdown import markdown

from lite_forms.components import FormGroup, Form, HiddenField, TreeNode

Expand Down Expand Up @@ -155,20 +154,6 @@ def heading_used_as_label(components):
return single_input


def convert_to_markdown(text):
if text:
text = "<br>".join([markdown(item.strip(), extensions=["nl2br"]) for item in text.split("\n\n")])
# Replace leading (<p>) & trailing (</p>) p tags as they are not needed
text = text.replace("<p>", "")
text = text.replace("</p>", "")
text = text.replace(
"<a", '<a class="govuk-link govuk-link--no-visited-state" rel="noreferrer noopener" target="_blank"'
)
return text
else:
return None


def handle_lists(data):
"""
By default get() returns only one value, we use getlist() to return multiple values
Expand Down

0 comments on commit 7315a8e

Please sign in to comment.