Skip to content

Commit

Permalink
CKAN core requires tmezone naive datetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansberry committed Dec 12, 2024
1 parent 3823024 commit 1a5c585
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions ckanext/dataset_subscriptions/actions/twilio_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
def send_twilio_notifications(context, data_dict):
message_sids = []
toolkit.check_access('send_email_notifications', context, data_dict)
users = toolkit.get_action('user_list')({'ignore_auth': True}, {'all_fields': True})
users = toolkit.get_action('user_list')(
{'ignore_auth': True},
{'all_fields': True, 'include_plugin_extras': True}
)
for user in users:
if _twilio_notifications_enabled(user):
recent_activities = _get_recent_activity_list(user, context)
Expand Down Expand Up @@ -52,7 +55,7 @@ def _twilio_notifications_enabled(user_dict):
def _twilio_notification_time_delta_utc():
since_hours = toolkit.config.get('ckanext.dataset_subscriptions.sms_notifications_hours_since', 1)
since_delta = timedelta(hours=int(since_hours))
since_datetime = (datetime.now(timezone.utc) - since_delta)
since_datetime = (datetime.utcnow() - since_delta)
return since_datetime


Expand Down
6 changes: 3 additions & 3 deletions ckanext/dataset_subscriptions/actions/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ def user_update(original_action, context, data_dict):
@toolkit.side_effect_free
def user_list(original_action, context, data_dict):
user_list = original_action(context, data_dict)
include_plugin_extras = all_fields = toolkit.asbool(data_dict.get('include_plugin_extras', False))
include_plugin_extras = toolkit.asbool(data_dict.get('include_plugin_extras', False))
all_fields = toolkit.asbool(data_dict.get('all_fields', True))
if all_fields and include_plugin_extras:
for user in user_list:
user = toolkit.get_action('user_show')(context, {'id': user['name']})
for index, user in enumerate(user_list):
user_list[index] = toolkit.get_action('user_show')(context, {'id': user['name']})
return user_list


Expand Down

0 comments on commit 1a5c585

Please sign in to comment.