Skip to content

Helper functions review #257

@katstevens

Description

@katstevens

Some of the helper functions in the scripts repo would be useful to have in digitalmarketplace-utils.

I've split into three categories: keep in scripts, move to utils, delete entirely.

Thoughts welcome!

Keep in scripts

auth_helpers.get_auth_token
Script-specific, for use within Docker

service_faker_helpers.*
As discussed with @galund, these functions are only used in a ‘one-off’ script for fake G9 services. However they could be useful for future frameworks where the questions change, and we want to know what potential answers would look like.

email_helpers.DEFAULT_REDIRECT_DOMAINS
We've previously agreed that config should stay out of utils.
email_helpers.scripts_notify_client
This just initialises the client using the above config.

framework_helpers.*
These all seem like legit shortcuts for API actions for the scripts using them.

html_helpers.render_html
I don't think this would be useful in utils, the FE apps can render html just fine.

logging_helpers.*
Script-specific logging config.

supplier_data_helpers.*
Not sure. These functions provide per-supplier context to Notify templates. Unlikely to be used outside scripts so keep for now?

Move to Utils

csv_helpers.*
Feels like these would be useful everywhere! We could deprecate utils.csv_generator (which only the admin FE uses) and move its functions into this. WON'T DO

env_helpers.*
Would be useful for the apps when generating emails to avoid hardcoding urls (it was this that prompted the review in the first place) DONE

email_helpers.get_sent_emails
This could easily be moved into dmutils.email.dm_mandrill. DONE

Delete entirely

auth_helpers.get_api_url
Duplicated by env_helpers.get_api_endpoint_from_stage. IN REVIEW

brief_data_helpers.get_briefs_closed_on_date
We can filter directly on find_briefs_iter now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions