Skip to content

Commit c449599

Browse files
committed
Merge branch 'refactor-notifications' of https://github.com/CenterForOpenScience/osf.io into add-new-notifications-data-model
* 'refactor-notifications' of https://github.com/CenterForOpenScience/osf.io: ignore Django maintenance state outside block
2 parents 2ab3589 + 22c62df commit c449599

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

osf/migrations/0030_new_notifications_model.py renamed to osf/migrations/0031_new_notifications_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class Migration(migrations.Migration):
99

1010
dependencies = [
11-
('osf', '0029_remove_abstractnode_keenio_read_key'),
11+
('osf', '0030_alter_osfgroupgroupobjectpermission_unique_together_and_more'),
1212
]
1313

1414
operations = [

tests/test_registrations/test_retractions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,7 @@ def test_non_contributor_GET_approval_returns_HTTPError_FORBIDDEN(self):
907907
assert self.registration.is_pending_retraction
908908
assert not self.registration.is_retracted
909909

910-
911-
def test_non_contributor_GET_disapproval_returns_HTTPError_UNAUTHORIZED(self):
910+
def test_non_contributor_GET_disapproval_returns_HTTPError_FORBIDDEN(self):
912911
non_contributor = AuthUserFactory()
913912
self.registration.retract_registration(self.user)
914913
rejection_token = self.registration.retraction.approval_state[self.user._id]['rejection_token']

website/maintenance.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,19 @@ def set_maintenance(message, level=1, start=None, end=None):
4242

4343
return {'start': state.start, 'end': state.end}
4444

45+
46+
class InFailedSqlTransaction:
47+
pass
48+
49+
4550
def get_maintenance():
4651
"""Get the current start and end times for the maintenance state.
4752
Return None if there is no current maintenance state.
4853
"""
49-
maintenance = MaintenanceState.objects.all().first()
54+
try:
55+
maintenance = MaintenanceState.objects.all().first()
56+
except InFailedSqlTransaction:
57+
return None
5058
return MaintenanceStateSerializer(maintenance).data if maintenance else None
5159

5260
def unset_maintenance():

0 commit comments

Comments
 (0)