@@ -49,7 +49,7 @@ def set_key(dotenv_path, key_to_set, value_to_set):
4949 value_to_set = str (value_to_set ).strip ("'" ).strip ('"' )
5050 if not os .path .exists (dotenv_path ):
5151 warnings .warn ("can't write to %s - it doesn't exist." % dotenv_path )
52- return None
52+ return None , key_to_set , value_to_set
5353 dotenv_as_dict = OrderedDict (parse_dotenv (dotenv_path ))
5454 dotenv_as_dict [key_to_set ] = value_to_set
5555 success = flatten_and_write (dotenv_path , dotenv_as_dict )
@@ -66,14 +66,13 @@ def unset_key(dotenv_path, key_to_unset):
6666 key_to_unset = str (key_to_unset )
6767 if not os .path .exists (dotenv_path ):
6868 warnings .warn ("can't delete from %s - it doesn't exist." % dotenv_path )
69- return None
69+ return None , key_to_unset
7070 dotenv_as_dict = OrderedDict (parse_dotenv (dotenv_path ))
7171 if key_to_unset in dotenv_as_dict :
7272 dotenv_as_dict .pop (key_to_unset , None )
7373 else :
74- warnings .warn (
75- "key %s not removed from %s - key doesn't exist." % (key_to_unset , dotenv_path ))
76- return None
74+ warnings .warn ("key %s not removed from %s - key doesn't exist." % (key_to_unset , dotenv_path ))
75+ return None , key_to_unset
7776 success = flatten_and_write (dotenv_path , dotenv_as_dict )
7877 return success , key_to_unset
7978
0 commit comments