Skip to content

Commit

Permalink
Revert manual service encoding/decoding deprecation
Browse files Browse the repository at this point in the history
This reverts commit edfa629.

Maybe worth adding it back later.
  • Loading branch information
davelopez committed Jan 31, 2023
1 parent 968f8b8 commit 41d6e66
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions lib/galaxy/webapps/galaxy/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
)

from celery.result import AsyncResult
from deprecated import deprecated

from galaxy.exceptions import (
AuthenticationRequired,
Expand Down Expand Up @@ -49,11 +48,6 @@ class SecurityNotProvidedError(Exception):
pass


MANUAL_ENCODING_DEPRECATION_MESSAGE = (
"Use model decoding/encoding instead with DecodedDatabaseIdField or EncodedDatabaseIdField."
)


class ServiceBase:
"""Base class with common logic and utils reused by other services.
Expand All @@ -70,32 +64,27 @@ def __init__(self, security: Optional[IdEncodingHelper] = None):
self._security = security

@property
@deprecated(reason=MANUAL_ENCODING_DEPRECATION_MESSAGE)
def security(self) -> IdEncodingHelper:
if self._security is None:
raise SecurityNotProvidedError(
"Security encoding helper must be set in the service constructor to encode/decode ids."
)
return self._security

@deprecated(reason=MANUAL_ENCODING_DEPRECATION_MESSAGE)
def decode_id(self, id: EncodedDatabaseIdField, kind: Optional[str] = None) -> int:
"""Decodes a previously encoded database ID."""
return decode_with_security(self.security, id, kind=kind)

@deprecated(reason=MANUAL_ENCODING_DEPRECATION_MESSAGE)
def encode_id(self, id: int, kind: Optional[str] = None) -> EncodedDatabaseIdField:
"""Encodes a raw database ID."""
return encode_with_security(self.security, id, kind=kind)

@deprecated(reason=MANUAL_ENCODING_DEPRECATION_MESSAGE)
def decode_ids(self, ids: List[EncodedDatabaseIdField]) -> List[int]:
"""
Decodes all encoded IDs in the given list.
"""
return [self.decode_id(id) for id in ids]

@deprecated(reason=MANUAL_ENCODING_DEPRECATION_MESSAGE)
def encode_all_ids(self, rval, recursive: bool = False):
"""
Encodes all integer values in the dict rval whose keys are 'id' or end with '_id'
Expand Down

0 comments on commit 41d6e66

Please sign in to comment.