Commit Graph

5681 Commits

Author SHA1 Message Date
Leo Hemsted
f0c61c8f29 Merge pull request #2190 from alphagov/template-folders
add TemplateFolder model
2018-10-29 15:00:49 +00:00
Leo Hemsted
7d0fa279a3 eager join folders from the Template object to keep versioning working
The `@version_class` decorator looks at every dirty (modified) model in
the session to work out which new history models to create. However, if
there are dirty items in the session, sqlalchemy might flush to the
database, clearing the whole session.

We ran into problems with the archive service function, which is
versioned for api keys, templates and services. When constructing the
TemplateHistory objects, `history_meta.py::create_history` would call
getattr on `Template.folders`, which would make a database call to join
across to the TemplateFolder objects - this would then flush the dirty
Service object from the session before the ServiceHistory object was
created.

To get around this, we eager load the Template.folder object, joining
on to it automatically when the Template is fetched. That way, it
doesn't make a SELECT mid-way through the version decorator, and the
history is preserved.

Note: This relationship is only on Template, not TemplateHistory - so
we're not doing this join every single time we send a message.
2018-10-29 11:57:24 +00:00
Katie Smith
a86b4bc63b Merge pull request #2191 from alphagov/pyup-update-pytest-3.9.2-to-3.9.3
Update pytest to 3.9.3
2018-10-29 11:10:22 +00:00
Katie Smith
e9909a5026 Merge pull request #2188 from alphagov/bump-utils-30.5.6
Update notifications-utils to 30.5.6
2018-10-29 11:10:05 +00:00
Katie Smith
9ccffb6980 Update notifications-utils to 30.5.6
This brings in the change to email validation which removes obsure white
space from email addresses.
2018-10-29 09:33:55 +00:00
pyup-bot
dd6f4fb64d Update pytest from 3.9.2 to 3.9.3 2018-10-27 19:12:13 +01:00
Leo Hemsted
0d5f8cc7df add status endpoint to '/'
paas were trying to ascertain if notify was up by looking at '/', for cert
renewal. This commit adds the status endpoint to '/', so we're not mistakenly
left for our cert to expire
2018-10-26 18:02:41 +01:00
Leo Hemsted
ac5c19c3d5 remove some pytest warnings 2018-10-26 17:54:53 +01:00
Leo Hemsted
5693d1181e add notify_db_session to test funcs that hit db 2018-10-26 17:51:50 +01:00
Leo Hemsted
936c8489b3 add TemplateFolder model
a TemplateFolder has a service, a name, and a parent. Parent is a
nullable foreign key pointing to another TemplateFolder instance. We
don't do any checks here for cyclical or otherwise invalid folder
structures so keep your data clean, folks!

Unsurprisingly, a Template can be part of a TemplateFolder - there's a
mapping class (template_folder_map to avoid giving it a dumb name) -
this mapping table shouldn't be interacted with directly - rather, you
should use the `Template.folder` or `TemplateFolder.templates`
relationship.
2018-10-26 17:50:31 +01:00
Katie Smith
6bd3cb1f27 Merge pull request #2189 from alphagov/more-letter-logos
Add ACAS to dvla_org_id table
2018-10-26 15:49:48 +01:00
Katie Smith
cbb4a2c3b2 Add ACAS to dvla_org_id table 2018-10-26 10:33:11 +01:00
Katie Smith
0ce1365305 Merge pull request #2186 from alphagov/make-dvla-table-fields-required
Make name and filename fields of DVLAOrganisation non-nullable
2018-10-25 14:32:12 +01:00
Katie Smith
4c630ba2e2 Make name and filename fields of DVLAOrganisation non-nullable
If either of these fields are null, previewing a letter template won't
work.
2018-10-25 13:27:44 +01:00
Katie Smith
5a627e2077 Merge pull request #2180 from alphagov/pyup-update-pytest-3.9.1-to-3.9.2
Update pytest to 3.9.2
2018-10-25 13:17:10 +01:00
Katie Smith
950074fa35 Merge pull request #2187 from alphagov/add-folder-permission
Add edit_folders service permission
2018-10-25 13:16:53 +01:00
Katie Smith
b2c4fc2787 Add edit_folders service permission
This is a temporary permission to allow some services to see and
edit folders before the feature is turned on for everyone.
2018-10-25 11:19:36 +01:00
Rebecca Law
57de7596d8 Merge pull request #2182 from alphagov/add-more-information-to-log
Added inbound_sms_id to log output
2018-10-25 11:12:46 +01:00
Rebecca Law
b2d12e6609 Merge pull request #2171 from alphagov/update-page-count-after-antivirus-scan
Update page count after antivirus scan
2018-10-25 11:11:59 +01:00
Rebecca Law
9ee55155cc Add service id to log 2018-10-24 16:37:38 +01:00
Katie Smith
0403105d3a Merge pull request #2183 from alphagov/stop-sending-dvla-org-id
Stop passing dvla_org_id to template preview
2018-10-24 16:27:58 +01:00
Rebecca Law
4cfd5489c8 Merge branch 'master' into add-more-information-to-log 2018-10-24 16:26:44 +01:00
Rebecca Law
5459009f5a Switch order of service and inbound_sms_id in message.
Added service id to retry message
2018-10-24 16:19:17 +01:00
Rebecca Law
a5309e655b Merge pull request #2185 from alphagov/dont-send-dr-for-pending
Some minor refactoring
2018-10-24 15:43:55 +01:00
Rebecca Law
12d938b82b Merge branch 'master' into update-page-count-after-antivirus-scan 2018-10-24 15:13:11 +01:00
Rebecca Law
1cc2d26586 Explicitly set the billable units for update_letter_pdf_status 2018-10-24 14:50:50 +01:00
Rebecca Law
537ab2e965 Fix merge error.
Moved the billable unit calculation before the santise call.
2018-10-24 14:38:09 +01:00
Rebecca Law
00f04c33c8 Some minor refactoring.
- Updated notifications_dao.update_notification_status_by_id with an optional parameter to set the sent_by, this will eliminate a separate update to notifcaitons.
- Added the callback url to the log message, that way we can see if it's the same url failing.
- Stop sending the status callbacks for PENDING status.
2018-10-24 11:24:53 +01:00
Katie Smith
022b5b19ff Stop passing dvla_org_id to template preview
We were passing both dvla_org_id and filename to template-preview
temporarily while we switch to only using filename. Now that
template-preview is set up to use the filename, we can stop sending the
dvla_org_id too.
2018-10-23 15:52:44 +01:00
Rebecca Law
77d1bc73b5 Added inbound_sms_id to log output, the extra information may help when trying to help debug an issue. 2018-10-23 13:59:52 +01:00
pyup-bot
a21b49a7f7 Update pytest from 3.9.1 to 3.9.2 2018-10-23 03:56:05 +01:00
Leo Hemsted
08caaec0f8 Merge pull request #2179 from alphagov/on-second-thoughts-lets-go-alone
pin itsdangerous to v0.24
2018-10-22 17:07:52 +01:00
Leo Hemsted
58cd349194 pin itsdangerous to v0.24
itsdangerous v1 uses sha512 instead of sha1 to sign and unsign its
strings. Pin to 0.24 until we figure a migration plan, since it's
used in a few places (In the DB, in email tokens, and sending blobs
to celery at least).
2018-10-22 17:00:04 +01:00
Leo Hemsted
6dd255e474 Merge pull request #2178 from alphagov/reqs-bumps
bump requirements
2018-10-22 15:50:20 +01:00
Leo Hemsted
29ea2e51d6 bump requirements
also pyup ignore awscli and botocore because that complex mesh of
dependency hell doesn't play will with pyup opening a new PR every time
that botocore/awscli update (every few days)
2018-10-22 14:43:08 +01:00
Leo Hemsted
340db1dec6 Merge pull request #2177 from alphagov/err-logs
don't log exception info for retries
2018-10-22 13:32:03 +01:00
Leo Hemsted
bc3fab09d0 don't log exception info for retries
it includes task args, which might contain PII. And we don't need to
know where the retry exception came from - it came from the line above
2018-10-22 11:33:16 +01:00
Tom Byers
6c613484ef Merge pull request #2158 from alphagov/bump-utils-to-3.5.5
Bump utils to 3.5.5
2018-10-19 15:07:48 +01:00
Alexey Bezhan
5d91ba80fb Merge pull request #2170 from alphagov/reduce-logging-for-sanitise
Reduce the error logging for sanitse method
2018-10-19 14:40:50 +01:00
Katie Smith
c55bfd7328 Merge pull request #2168 from alphagov/send-letter-filename-to-template-preview
Send letter filename to template preview
2018-10-19 10:57:42 +01:00
Katie Smith
4dab4fa8ce Pass letter logo filename to template preview
We now pass `filename`, the filename of the letter logo to use, through
to Template Preview in addition to the `dvla_org_id`. Once Template
Preview has been updated to only use the `filename` we will stop
sending the `dvla_org_id`.
2018-10-19 10:07:11 +01:00
Katie Smith
51a18ef0b4 Merge pull request #2160 from alphagov/update-service-schema
Update service schema to add letter_logo_filename
2018-10-19 10:05:54 +01:00
Rebecca Law
02154f5fc0 Actually I decided we don't need an exception log here. 2018-10-18 16:46:04 +01:00
Rebecca Law
38c29d41a4 Reduce the error logging for sanitse method, since we ignore cysp.
Also fixed the spelling error, why not.
2018-10-18 16:43:14 +01:00
Rebecca Law
021a90f482 Merge branch 'master' into update-page-count-after-antivirus-scan 2018-10-18 16:01:59 +01:00
Leo Hemsted
4dbedd02a3 Merge pull request #2167 from alphagov/compare-to-uuid
compare service id to UUID
2018-10-18 13:20:15 +01:00
Leo Hemsted
e7dad9436f compare service id to UUID
it doesn't match a string 😩
I couldn't think of a good way to test this in a unit test, since
it involves changing the service id on all of the components of a
service.
2018-10-18 12:19:10 +01:00
Katie Smith
e7f0a414ce Update service schema to add letter_logo_filename
Added the filename of a service's letter logo to the service schema. We want
this in the schema so that it is possible to call
`current_service.letter_logo_filename` from notifications-admin and to pass this value
through to template-preview.
2018-10-18 08:48:06 +01:00
Leo Hemsted
e0056aad3f Merge pull request #2164 from alphagov/fix-bucket-names
make sure validation_failed notifications still return pdf
2018-10-17 17:04:25 +01:00
Leo Hemsted
3589f1dd63 remove some use of calling fixtures directly
also experiment with giving the fixtures a different name, so we can be
sure that they won't be called in functions. Open to change on this.
2018-10-17 16:38:46 +01:00