コード例 #1
0
def get_framework_contract_title(content_path: str,
                                 framework_slug: str) -> str:
    """The contract title is different for G-Cloud and DOS. Look up the correct name with the content loader"""
    content_loader = ContentLoader(content_path)
    content_loader.load_messages(framework_slug, ["e-signature"])
    return str(
        content_loader.get_message(framework_slug, "e-signature",
                                   "framework_contract_title"))
logger = logging_helpers.configure_logger()

if __name__ == '__main__':
    arguments = docopt(__doc__)
    supplier_ids = get_supplier_ids_from_args(arguments)

    STAGE = arguments['<stage>']
    FRAMEWORK_SLUG = arguments['<framework>']
    GOVUK_NOTIFY_API_KEY = arguments['<notify_api_key>']
    GOVUK_NOTIFY_TEMPLATE_ID = arguments['<notify_template_id>']
    CONTENT_PATH = arguments['<content_path>']
    DRY_RUN = arguments['--dry-run']

    content_loader = ContentLoader(CONTENT_PATH)
    content_loader.load_messages(FRAMEWORK_SLUG, ['e-signature'])
    mail_client = scripts_notify_client(GOVUK_NOTIFY_API_KEY, logger=logger)
    api_client = DataAPIClient(base_url=get_api_endpoint_from_stage(STAGE),
                               auth_token=get_auth_token('api', STAGE))

    context_helper = SuccessfulSupplierContextForNotify(
        api_client, FRAMEWORK_SLUG, supplier_ids=supplier_ids, logger=logger)
    context_helper.populate_data()
    context_data = context_helper.get_users_personalisations()
    framework = api_client.get_framework(FRAMEWORK_SLUG).get('frameworks')

    prefix = "[Dry Run] " if DRY_RUN else ""

    # Add in any framework-specific dates etc here
    extra_template_context = {
        "contract_title":
コード例 #3
0
def _make_content_loader_factory():
    master_cl = ContentLoader('app/content')
    master_cl.load_manifest('g-cloud-6', 'services', 'edit_service')
    master_cl.load_messages('g-cloud-6', ['urls'])

    master_cl.load_manifest('g-cloud-7', 'services', 'edit_service')
    master_cl.load_manifest('g-cloud-7', 'services', 'edit_submission')
    master_cl.load_manifest('g-cloud-7', 'declaration', 'declaration')
    master_cl.load_messages('g-cloud-7', ['urls'])

    master_cl.load_manifest('digital-outcomes-and-specialists', 'declaration', 'declaration')
    master_cl.load_manifest('digital-outcomes-and-specialists', 'services', 'edit_submission')
    master_cl.load_manifest('digital-outcomes-and-specialists', 'briefs', 'edit_brief')
    master_cl.load_messages('digital-outcomes-and-specialists', ['urls'])

    master_cl.load_manifest('digital-outcomes-and-specialists-2', 'declaration', 'declaration')
    master_cl.load_manifest('digital-outcomes-and-specialists-2', 'services', 'edit_submission')
    master_cl.load_manifest('digital-outcomes-and-specialists-2', 'services', 'edit_service')
    master_cl.load_manifest('digital-outcomes-and-specialists-2', 'briefs', 'edit_brief')
    master_cl.load_messages('digital-outcomes-and-specialists-2', ['urls'])

    master_cl.load_manifest('g-cloud-8', 'services', 'edit_service')
    master_cl.load_manifest('g-cloud-8', 'services', 'edit_submission')
    master_cl.load_manifest('g-cloud-8', 'declaration', 'declaration')
    master_cl.load_messages('g-cloud-8', ['urls'])

    master_cl.load_manifest('g-cloud-9', 'services', 'edit_service')
    master_cl.load_manifest('g-cloud-9', 'services', 'edit_submission')
    master_cl.load_manifest('g-cloud-9', 'declaration', 'declaration')
    master_cl.load_messages('g-cloud-9', ['urls', 'advice'])

    master_cl.load_manifest('g-cloud-10', 'services', 'edit_service')
    master_cl.load_manifest('g-cloud-10', 'services', 'edit_submission')
    master_cl.load_manifest('g-cloud-10', 'declaration', 'declaration')
    master_cl.load_messages('g-cloud-10', ['urls', 'advice'])
    master_cl.load_metadata('g-cloud-10', ['copy_services'])

    master_cl.load_manifest('digital-outcomes-and-specialists-3', 'declaration', 'declaration')
    master_cl.load_manifest('digital-outcomes-and-specialists-3', 'services', 'edit_submission')
    master_cl.load_manifest('digital-outcomes-and-specialists-3', 'services', 'edit_service')
    master_cl.load_manifest('digital-outcomes-and-specialists-3', 'briefs', 'edit_brief')
    master_cl.load_messages('digital-outcomes-and-specialists-3', ['urls'])
    master_cl.load_metadata('digital-outcomes-and-specialists-3', ['copy_services', 'following_framework'])

    master_cl.load_manifest('g-cloud-11', 'services', 'edit_service')
    master_cl.load_manifest('g-cloud-11', 'services', 'edit_submission')
    master_cl.load_manifest('g-cloud-11', 'declaration', 'declaration')
    master_cl.load_messages('g-cloud-11', ['urls', 'advice'])
    master_cl.load_metadata('g-cloud-11', ['copy_services', 'following_framework'])

    master_cl.load_manifest('digital-outcomes-and-specialists-4', 'declaration', 'declaration')
    master_cl.load_manifest('digital-outcomes-and-specialists-4', 'services', 'edit_submission')
    master_cl.load_manifest('digital-outcomes-and-specialists-4', 'services', 'edit_service')
    master_cl.load_manifest('digital-outcomes-and-specialists-4', 'briefs', 'edit_brief')
    master_cl.load_messages('digital-outcomes-and-specialists-4', ['urls'])
    master_cl.load_metadata('digital-outcomes-and-specialists-4', ['copy_services', 'following_framework'])

    master_cl.load_manifest('g-cloud-12', 'services', 'edit_service')
    master_cl.load_manifest('g-cloud-12', 'services', 'edit_submission')
    master_cl.load_manifest('g-cloud-12', 'declaration', 'declaration')
    master_cl.load_messages('g-cloud-12', ['urls', 'advice', 'e-signature'])
    master_cl.load_metadata('g-cloud-12', ['copy_services', 'following_framework'])

    master_cl.load_manifest('digital-outcomes-and-specialists-5', 'declaration', 'declaration')
    master_cl.load_manifest('digital-outcomes-and-specialists-5', 'services', 'edit_submission')
    master_cl.load_manifest('digital-outcomes-and-specialists-5', 'services', 'edit_service')
    master_cl.load_manifest('digital-outcomes-and-specialists-5', 'briefs', 'edit_brief')
    master_cl.load_messages('digital-outcomes-and-specialists-5', ['urls', 'e-signature'])
    master_cl.load_metadata('digital-outcomes-and-specialists-5', ['copy_services', 'following_framework'])

    # seal master_cl in a closure by returning a function which will only ever return an independent copy of it
    return lambda: deepcopy(master_cl)
コード例 #4
0
from flask import Blueprint
from dmcontent.content_loader import ContentLoader

main = Blueprint('main', __name__)

content_loader = ContentLoader('app/content')
content_loader.load_manifest('g-cloud-6', 'services', 'edit_service')
content_loader.load_messages('g-cloud-6', ['dates'])

content_loader.load_manifest('g-cloud-7', 'services', 'edit_service')
content_loader.load_manifest('g-cloud-7', 'services', 'edit_submission')
content_loader.load_manifest('g-cloud-7', 'declaration', 'declaration')
content_loader.load_messages('g-cloud-7', ['dates'])

content_loader.load_manifest('digital-outcomes-and-specialists', 'declaration',
                             'declaration')
content_loader.load_manifest('digital-outcomes-and-specialists', 'services',
                             'edit_submission')
content_loader.load_manifest('digital-outcomes-and-specialists',
                             'brief-responses', 'edit_brief_response')
content_loader.load_messages('digital-outcomes-and-specialists', ['dates'])

content_loader.load_manifest('g-cloud-8', 'services', 'edit_service')
content_loader.load_manifest('g-cloud-8', 'services', 'edit_submission')
content_loader.load_manifest('g-cloud-8', 'declaration', 'declaration')
content_loader.load_messages('g-cloud-8', ['dates'])


@main.after_request
def add_cache_control(response):
    response.cache_control.no_cache = True
コード例 #5
0
from flask import Blueprint
from dmcontent.content_loader import ContentLoader

main = Blueprint('main', __name__)

content_loader = ContentLoader('app/content')
content_loader.load_manifest('g-cloud-6', 'services', 'edit_service')
content_loader.load_messages('g-cloud-6', ['dates'])

content_loader.load_manifest('g-cloud-7', 'services', 'edit_service')
content_loader.load_manifest('g-cloud-7', 'services', 'edit_submission')
content_loader.load_manifest('g-cloud-7', 'declaration', 'declaration')
content_loader.load_messages('g-cloud-7', ['dates'])

content_loader.load_manifest('digital-outcomes-and-specialists', 'declaration',
                             'declaration')
content_loader.load_manifest('digital-outcomes-and-specialists', 'services',
                             'edit_submission')
content_loader.load_manifest('digital-outcomes-and-specialists', 'briefs',
                             'edit_brief')
content_loader.load_manifest('digital-outcomes-and-specialists',
                             'brief-responses', 'edit_brief_response')
content_loader.load_manifest('digital-outcomes-and-specialists',
                             'brief-responses', 'display_brief_response')
content_loader.load_messages('digital-outcomes-and-specialists', ['dates'])

content_loader.load_manifest('digital-service-professionals', 'declaration',
                             'declaration')
content_loader.load_manifest('digital-service-professionals', 'services',
                             'edit_submission')
content_loader.load_manifest('digital-service-professionals', 'briefs',
コード例 #6
0
from flask import Blueprint
from dmcontent.content_loader import ContentLoader

main = Blueprint('main', __name__)

content_loader = ContentLoader('app/content')
content_loader.load_manifest('g-cloud-6', 'services', 'edit_service')
content_loader.load_messages('g-cloud-6', ['dates'])

content_loader.load_manifest('g-cloud-7', 'services', 'edit_service')
content_loader.load_manifest('g-cloud-7', 'services', 'edit_submission')
content_loader.load_manifest('g-cloud-7', 'declaration', 'declaration')
content_loader.load_messages('g-cloud-7', ['dates'])

content_loader.load_manifest('digital-outcomes-and-specialists', 'declaration', 'declaration')
content_loader.load_manifest('digital-outcomes-and-specialists', 'services', 'edit_submission')
content_loader.load_manifest('digital-outcomes-and-specialists', 'briefs', 'edit_brief')
content_loader.load_manifest('digital-outcomes-and-specialists', 'brief-responses', 'edit_brief_response')
content_loader.load_manifest('digital-outcomes-and-specialists', 'brief-responses', 'display_brief_response')
content_loader.load_messages('digital-outcomes-and-specialists', ['dates'])

content_loader.load_manifest('digital-service-professionals', 'declaration', 'declaration')
content_loader.load_manifest('digital-service-professionals', 'services', 'edit_submission')
content_loader.load_manifest('digital-service-professionals', 'briefs', 'edit_brief')
content_loader.load_manifest('digital-service-professionals', 'brief-responses', 'edit_brief_response')
content_loader.load_manifest('digital-service-professionals', 'brief-responses', 'display_brief_response')
content_loader.load_messages('digital-service-professionals', ['dates'])

content_loader.load_manifest('digital-marketplace', 'declaration', 'declaration')
content_loader.load_manifest('digital-marketplace', 'services', 'edit_submission')
content_loader.load_manifest('digital-marketplace', 'briefs', 'edit_brief')
コード例 #7
0
    if bool(arguments.get("--notify-key")) != bool(
            arguments.get("--notify-template-id")):
        raise ValueError(
            "Either specify both --notify-key and --notify-template-id or neither"
        )

    stage = arguments['<stage>']
    data_api_client = DataAPIClient(get_api_endpoint_from_stage(stage),
                                    get_auth_token('api', stage))
    framework_slug = arguments['<framework_slug>']
    framework = data_api_client.get_framework(framework_slug)["frameworks"]
    document_directory = arguments['<documents_directory>']
    content_path = arguments['<content_path>']
    content_loader = ContentLoader(content_path)
    if framework['isESignatureSupported']:
        content_loader.load_messages(framework_slug, ['e-signature'])
        contract_title = content_loader.get_message(
            framework_slug, 'e-signature', 'framework_contract_title')
    else:
        contract_title = 'Framework Agreement'

    dry_run = arguments['--dry-run']
    dm_notify_client = arguments.get("--notify-key") and scripts_notify_client(
        arguments["--notify-key"], logger=logger)

    if dry_run:
        bucket = None
    else:
        bucket = S3(get_bucket_name(stage, "agreements"))

    failure_count = 0
コード例 #8
0
from flask import Blueprint
from dmcontent.content_loader import ContentLoader

main = Blueprint('main', __name__)

content_loader = ContentLoader('app/content')
content_loader.load_manifest('g-cloud-6', 'services', 'edit_service')
content_loader.load_messages('g-cloud-6', ['dates'])

content_loader.load_manifest('g-cloud-7', 'services', 'edit_service')
content_loader.load_manifest('g-cloud-7', 'services', 'edit_submission')
content_loader.load_manifest('g-cloud-7', 'declaration', 'declaration')
content_loader.load_messages('g-cloud-7', ['dates'])

content_loader.load_manifest('digital-outcomes-and-specialists', 'declaration', 'declaration')
content_loader.load_manifest('digital-outcomes-and-specialists', 'services', 'edit_submission')
content_loader.load_manifest('digital-outcomes-and-specialists', 'brief-responses', 'edit_brief_response')
content_loader.load_messages('digital-outcomes-and-specialists', ['dates'])

content_loader.load_manifest('g-cloud-8', 'services', 'edit_service')
content_loader.load_manifest('g-cloud-8', 'services', 'edit_submission')
content_loader.load_manifest('g-cloud-8', 'declaration', 'declaration')
content_loader.load_messages('g-cloud-8', ['dates'])


@main.after_request
def add_cache_control(response):
    response.cache_control.no_cache = True
    return response