File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -112,9 +112,11 @@ def get(self, id: int):
112
112
with self ._ob .read_tx ():
113
113
c_data = ctypes .c_void_p ()
114
114
c_size = ctypes .c_size_t ()
115
- obx_box_get (self ._c_box , id , ctypes .byref (
116
- c_data ), ctypes .byref (c_size ))
117
-
115
+ try :
116
+ obx_box_get (self ._c_box , id , ctypes .byref (
117
+ c_data ), ctypes .byref (c_size ))
118
+ except NotFoundException :
119
+ return None
118
120
data = c_voidp_as_bytes (c_data , c_size .value )
119
121
return self ._entity .unmarshal (data )
120
122
@@ -143,7 +145,11 @@ def remove(self, id_or_object):
143
145
id = self ._entity .get_object_id (id_or_object )
144
146
else :
145
147
id = id_or_object
146
- obx_box_remove (self ._c_box , id )
148
+ try :
149
+ obx_box_remove (self ._c_box , id )
150
+ return True
151
+ except NotFoundException :
152
+ return False
147
153
148
154
def remove_all (self ) -> int :
149
155
count = ctypes .c_uint64 ()
You can’t perform that action at this time.
0 commit comments