Skip to content

Commit

Permalink
concept get | decoding concept id
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Jul 6, 2021
1 parent 9144511 commit f6c77c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ def is_url_encoded_string(string, lower=True):
return string == encoded_string


def decode_string(string):
return parse.unquote_plus(string)
def decode_string(string, plus=True):
return parse.unquote_plus(string) if plus else parse.unquote(string)


def encode_string(string, **kwargs):
Expand Down
5 changes: 3 additions & 2 deletions core/concepts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from core.common.tasks import process_hierarchy_for_new_concept, process_hierarchy_for_concept_version, \
process_hierarchy_for_new_parent_concept_version
from core.common.utils import reverse_resource, parse_updated_since_param, generate_temp_version, drop_version, \
encode_string
encode_string, decode_string
from core.concepts.constants import CONCEPT_TYPE, LOCALES_FULLY_SPECIFIED, LOCALES_SHORT, LOCALES_SEARCH_INDEX_TERM, \
CONCEPT_WAS_RETIRED, CONCEPT_IS_ALREADY_RETIRED, CONCEPT_IS_ALREADY_NOT_RETIRED, CONCEPT_WAS_UNRETIRED, \
PERSIST_CLONE_ERROR, PERSIST_CLONE_SPECIFY_USER_ERROR, ALREADY_EXISTS, CONCEPT_REGEX
Expand Down Expand Up @@ -369,7 +369,8 @@ def get_base_queryset(cls, params): # pylint: disable=too-many-branches,too-man
queryset = queryset.filter(cls.get_iexact_or_criteria('sources__version', container_version))
if concept:
mnemonics = [concept, encode_string(concept, safe=' '), encode_string(concept, safe='+'),
encode_string(concept, safe='+%'), encode_string(concept, safe='% +')]
encode_string(concept, safe='+%'), encode_string(concept, safe='% +'),
decode_string(concept), decode_string(concept, False)]
queryset = queryset.filter(mnemonic__in=mnemonics)
if concept_version:
queryset = queryset.filter(cls.get_iexact_or_criteria('version', concept_version))
Expand Down

0 comments on commit f6c77c6

Please sign in to comment.