File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments