Skip to content

Commit

Permalink
[QCDP24-25] fix linting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
awset committed Aug 3, 2024
1 parent 85f21c9 commit 009bae1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ckanext/datarequests/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def update_datarequest(context, data_dict):
is_current_creator = auth_if_creator(context, data_dict, constants.SHOW_DATAREQUEST)
if (is_current_creator['success'] is True):
return is_current_creator

return auth_if_editor_or_admin(context, data_dict, constants.SHOW_DATAREQUEST)


Expand Down
2 changes: 1 addition & 1 deletion ckanext/datarequests/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_ordered_by_date(cls, organization_id=None, user_id=None, closed=None, q=
order_by_filter = cls.open_time.desc() if desc else cls.open_time.asc()

current_user_id = current_user.id if current_user else None

if current_user_id:
current_user_order = case(
[(cls.user_id == current_user_id, 1)],
Expand Down
8 changes: 4 additions & 4 deletions ckanext/datarequests/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import datetime

import ckan.plugins.toolkit as tk
from ckanext.datarequests import db, common, constants
from ckanext.datarequests import db, common, constants # noqa: F401


def profanity_check_enabled():
Expand Down Expand Up @@ -60,7 +60,7 @@ def validate_datarequest(context, request_data):

if len(description) > constants.DESCRIPTION_MAX_LENGTH:
_add_error(errors, description_field, tk._('Purpose of data use must be a maximum of %d characters long') % constants.DESCRIPTION_MAX_LENGTH)

if description and not _has_alpha_chars(description, 2):
_add_error(errors, description_field, tk._('Purpose of data use need to be longer than two characters and alphabetical'))

Expand Down Expand Up @@ -89,7 +89,7 @@ def validate_datarequest(context, request_data):
who_will_access_this_data_field = tk._('Who will access this data')
if not who_will_access_this_data:
_add_error(errors, who_will_access_this_data_field, tk._('Who will access this data cannot be empty'))

if who_will_access_this_data and not _has_alpha_chars(who_will_access_this_data, 2):
_add_error(errors, who_will_access_this_data_field, tk._('Who will access this data need to be longer than two characters and alphabetical'))

Expand All @@ -98,7 +98,7 @@ def validate_datarequest(context, request_data):
requesting_organisation_field = tk._('Requesting organisation')
if not requesting_organisation:
_add_error(errors, requesting_organisation_field, tk._('Requesting organisation cannot be empty'))

# Check requesting_organisation is a valid organisation in database.
if requesting_organisation:
try:
Expand Down

0 comments on commit 009bae1

Please sign in to comment.