Commit Graph

132 Commits

Author SHA1 Message Date
Rebecca Law
1f591d3490 Add iso8601 to requirements 2017-05-25 16:13:33 +01:00
Chris Hill-Scott
e443dc7fed Output contact blocks with placeholders replaced
Brings in:
- [ ] https://github.com/alphagov/notifications-utils/pull/161

Also brings in:
https://github.com/alphagov/notifications-utils/compare/16.1.3...17.0.2
2017-05-11 16:50:36 +01:00
Rebecca Law
42032f871f removed Flask-Redis dependency, it's included in notification-utils. 2017-05-04 14:57:57 +01:00
Martyn Inglis
56a82bb593 Bumped utils version 2017-04-27 09:45:36 +01:00
Martyn Inglis
86a5445fb6 Bumped utils version 2017-04-27 09:26:12 +01:00
Martyn Inglis
2a1c3c248f Bumped utils 2017-04-26 21:21:00 +01:00
Martyn Inglis
2a0f8c8808 Validate International phone numbers
- uses new utils methods to validate phone numbers
- defaults to International=True on validation. This ensures the validator works on all numbers
- Then check if the user can send this message to the number internationally if needed.
2017-04-26 15:56:45 +01:00
Martyn Inglis
d6fc2335e6 Latest utils 2017-04-13 12:52:56 +01:00
Rebecca Law
6949779544 Refactor s3upload
s3upload function has been moved to notifications-utils.
https://github.com/alphagov/notifications-utils/pull/138 must be merge first.

Remove scratch code that I was using to test celery.send_task method

Revert the update to default_retry_delay.
Increase the countdown, wait 1 minute before executing the task.

Some of the changes in my previous commit are included here, that branch will be merged before this one, so it will make sense.

Update version of notification_utils

Update the version of notifications-utils
2017-04-10 17:17:58 +01:00
Rebecca Law
65a91c440b Refactor s3upload
s3upload function has been moved to notifications-utils.
https://github.com/alphagov/notifications-utils/pull/138 must be merge first.
2017-04-10 17:12:56 +01:00
Chris Hill-Scott
7a6d748c6a Build DVLA file with blank TO_NAME_2 field
Problem: we were sending the first line of the address in the
`TO_NAME_2` field. This meant that they couldn’t do any PAF lookups with
it, because it wasn’t where they were expecting.

The first line of the address is the second line of what our users give
us. We need to give this to DVLA as the _third_ line of the address
output, which they call `TO_ADDRESS_LINE_1`.
2017-04-06 13:12:05 +01:00
Chris Hill-Scott
f98f220e74 Update utils to fix letter output
Includes:
- [x] https://github.com/alphagov/notifications-utils/pull/136
- [ ] https://github.com/alphagov/notifications-utils/pull/131
2017-04-05 12:35:28 +01:00
Chris Hill-Scott
1802c84b8a Add handling for data types other than list/string
Brings in:
- [ ] https://github.com/alphagov/notifications-utils/pull/135

Also adds extra tests for:
- the exact issue that we saw in production when #867 was deployed
- what happens when `None` is passed as a placeholder value, because
  this should never get as far as the relevant bit of utils
2017-04-05 09:28:17 +01:00
Chris Hill-Scott
7943b6819b Revert "Revert "Bump utils to allow lists as placeholder values"" 2017-04-05 09:18:58 +01:00
Chris Hill-Scott
cb208473c6 Revert "Bump utils to allow lists as placeholder values" 2017-04-04 15:19:53 +01:00
Chris Hill-Scott
b19486ec99 Include fixes for heading spacing
Brings in
- [x] https://github.com/alphagov/notifications-utils/pull/134
2017-04-03 17:22:34 +01:00
Chris Hill-Scott
585ef8e66a Bump utils to allow lists as placeholder values
Brings in:
- [ ] https://github.com/alphagov/notifications-utils/pull/128

Also adds a test to make sure that passing a dictionary as a value in
the `personalisation` argument works.
2017-03-31 17:02:54 +01:00
Rebecca Law
31979c3272 Use 500 for org id 2017-03-27 17:49:09 +01:00
Rebecca Law
0705cf2f7c Update requirements.txt
pin version of six to resolve deployment issues
2017-03-27 11:12:39 +01:00
Rebecca Law
37a5ce601a Update the version of notifications-utils.
There was a problem with the address block for the DVLATemplate.

Added a countdown to the build_dvla_file.
2017-03-24 15:25:02 +00:00
Imdad Ahad
9ab6d4c68b Update boto3 2017-02-23 17:21:15 +00:00
Leo Hemsted
90dab2a32a bump utils to 13.8.0
brings in character downgrading in SMS previews
2017-02-20 11:56:32 +00:00
Chris Hill-Scott
43173870cb Bump utils to turn off Markdown links 2017-02-17 10:18:52 +00:00
bandesz
72dc93c6db Add awslogs logging for PaaS 2017-02-16 17:38:30 +00:00
Chris Hill-Scott
b2267ae5fc Merge pull request #823 from alphagov/bump-utils-markdown-links
Bump utils to turn on Markdown links
2017-02-13 12:44:19 +00:00
Chris Hill-Scott
6c37686f71 Bump utils to turn on Markdown links 2017-02-08 17:01:44 +00:00
Martyn Inglis
5d0bc0abe8 Add a stop celery script into the scripts folder.
Stopping celery via upstart issues a TERM signal to the whole process group, which immediately kills the worker threads. This can lead to inconsistentcy in the state of a notification as an API call, for example, can take several seconds consequently the likelihood of the call being lost due to a restart is relatively high.

We need to ensure that we stop cleanly to ensure code deploys and autoscale events do not cause issues.

this script is called as part of a pre-stop hook in upstart, which passes a pid file location to the script. The script will then issues the TERM signal to only the master celery process. which will cleanly shut down the workers and exit.

the script will loop based on the existence of a /proc/{pid} for the celery master process. Once the file is gone the script will exit. Upstart blocks on this script before issuing kill on whatever processes may be left hanging around.

the length of the loop is a maximum 15 minutes - which is the tested max time a task may take. In reality it will exit much quicker.
2017-02-08 16:17:50 +00:00
Chris Hill-Scott
6e6d471cda Don’t strip HTML when saving templates
Right now we strip HTML from templates at the point of saving them. This
also converts stuff like ampersands to their entity form (eg &) and
this is what we save in the database.

This is a bad idea when you’re sending a text message or a letter, in
which an HTML entity makes no sense. But we still need to encode HTML in
the body of HTML emails.

The right place to do this is when rendering the templates. The code to
do this is now in utils. So this commit:
- pull in this new utils code
- removes the old
- adds some integration tests to make sure that everything is working
  as expected (more thorough unit tests are happening in utils)
2017-01-19 12:05:28 +00:00
bandesz
fd66fbd719 Run API on Paas 2017-01-13 10:24:13 +00:00
Leo Hemsted
501187a9f4 bump utils to 13.0.1
brings in a fix to InvalidEmail/Phone/AddressExceptions not being
instantiated correctly. `exception.message` is not a python standard,
so we shouldn't be relying on it to transmit exception reasons -
rather we should be using `str(exception)` instead. This involved a
handful of small changes to the schema validation
2017-01-09 16:37:58 +00:00
Leo Hemsted
bf0abce4a3 update python-client version
also unpin the patch version, since it shouldn't matter what patch
we're on provided that the function signatures are the same
2016-12-22 13:53:33 +00:00
Leo Hemsted
5cbe4eb5b2 use cloudfront instead of flask to serve static images
branding in emails was previously hosted from admin app - this changes
the url to be static.{domain}/images instead of {domain}/static/images,
which redirects to cloudfront.

some manipulation of the URL was required to make sure it still serves
locally rather than returning "static.localhost:6012" for example.

(if ADMIN_BASE_URL is localhost it just returns the old /static/
path)

also was able to remove DB interaction from a test. woo!
2016-12-21 16:35:16 +00:00
Chris Hill-Scott
0cc94bc87b Include content count fix
Includes:
- [x] https://github.com/alphagov/notifications-utils/pull/102
2016-12-14 15:51:59 +00:00
Chris Hill-Scott
59af44d7ab Update utils to 12.0.0
Includes:

- [x] https://github.com/alphagov/notifications-utils/pull/94 (breaking
      changes which are responsible for all the changes to the API in
      this PR)

The test for `get_sms_fragment_count` has been removed because this
method is already tested in utils here:

ac20f7e99e/tests/test_base_template.py (L140-L159)
2016-12-13 10:57:01 +00:00
Martyn Inglis
869cf48eff Latest version 2016-12-06 16:51:46 +00:00
Chris Hill-Scott
1e4274655a Bump utils version to really bring in latest changes 2016-12-06 09:45:39 +00:00
Martyn Inglis
3342ca2993 Bumped version 2016-12-02 16:56:23 +00:00
Martyn Inglis
9fb378021c Bumped version to use latest utils
- note this is not yet published so will break.....
- sorts out an issue with service id logging
2016-12-01 17:24:23 +00:00
Martyn Inglis
9667d42008 Minor bump of utils 2016-12-01 12:47:33 +00:00
Martyn Inglis
5ae21bf1d5 Bumped requirements version 2016-12-01 11:34:38 +00:00
minglis
2e1578656b Merge pull request #735 from alphagov/caching-with-redis
Caching with redis
2016-11-25 09:06:12 +00:00
Rebecca Law
8cf324de85 Update python client from version 2.0.0 to 3.0.0 2016-11-22 14:59:14 +00:00
Martyn Inglis
7cfc58c994 Merge branch 'master' into caching-with-redis
Conflicts:
	app/celery/tasks.py
	tests/app/celery/test_tasks.py
2016-11-21 13:10:22 +00:00
Chris Hill-Scott
d51c63cb6b Merge pull request #722 from alphagov/whitepace-in-personalisation
Ignore case and whitespace in personalisation keys
2016-11-11 11:33:37 +01:00
Chris Hill-Scott
8474344c9a Ignore case and whitespace in personalisation keys
From a support ticket:

> it's possible to add a personalisation token with trailing whitespace
> (eg. "key " rather than "key"). Can this be trimmed in the UI to guard
> against this? (one of our devs copied and pasted it from a document
> and inadvertently included the space)

> Nothing major but caused a few hours of investigations!

Rather than trim the placeholder in the template, we should treat
placeholders in API calls the same way we do with CSV files, ie we
ignore case and spacing in the name of the placeholder. So
`(( First Name))` is equivalent to `((first_name))`, and both would be
populated with a dictionary like `{'firstName': 'Chris'}`.

Depends on:
- [x] https://github.com/alphagov/notifications-utils/pull/77
2016-11-10 11:40:00 +00:00
Martyn Inglis
eb94fe6c0a Adding Flask-Redis to the project.
[https://pypi.python.org/pypi/Flask-Redis/0.1.0](https://pypi.python.org/pypi/Flask-Redis/0.1.0)

Initial addition as we think about redis as cache.
2016-11-10 11:27:57 +00:00
Martyn Inglis
aea2356ae1 Initial SPIKE into redis for cache 2016-11-07 11:55:59 +00:00
Leo Hemsted
f089b75129 update python client to 2.0.0
this is to prevent 500 errors because <2.0.0 raised AssertionError
if supplied JWT tokens were incorrectly formatted

tests added
2016-11-03 17:05:25 +00:00
bandesz
edf22860e1 Bump boto version to 2.43.0-patch3 2016-11-02 17:59:09 +00:00
Rebecca Law
83f3c92c24 Move jsonschema to requirements.txt to missing dependency 2016-11-02 14:02:06 +00:00