Skip to content

Commit 51ccb5c

Browse files
fix
1 parent bc9f565 commit 51ccb5c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/quart_sqlalchemy/sim/util.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def __init__(self, input_value):
3030
elif isinstance(input_value, ObjectID):
3131
self._source_id = input_value._decoded_id
3232
elif isinstance(input_value, str):
33-
self._source_id = input_value
34-
self._decode()
33+
self._source_id = self._decode(input_value)
3534
elif isinstance(input_value, numbers.Number):
3635
try:
3736
input_value = int(input_value)
@@ -47,7 +46,7 @@ def _encoded_id(self):
4746

4847
@property
4948
def _decoded_id(self):
50-
return self._decode()
49+
return self._source_id
5150

5251
def __eq__(self, other):
5352
if isinstance(other, ObjectID):
@@ -88,11 +87,11 @@ def _encode(self):
8887
def encode(self):
8988
return self._encoded_id
9089

91-
def _decode(self):
92-
if isinstance(self._source_id, int):
93-
return self._source_id
90+
def _decode(self, value):
91+
if isinstance(value, int):
92+
return value
9493
else:
95-
return self.hashids.decode(self._source_id)
94+
return self.hashids.decode(value)[0]
9695

9796
def decode(self):
9897
return self._decoded_id

0 commit comments

Comments
 (0)