Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix issue with long key in do_delete()

  • Loading branch information...
commit 0983c6032d2976bcfd696088aae58e455ef7e330 1 parent 95bd14b
@ownport authored
Showing with 12 additions and 8 deletions.
  1. +12 −8 kvlite-cli.py
View
20 kvlite-cli.py
@@ -5,7 +5,7 @@
#
#
__author__ = 'Andrey Usov <http://devel.ownport.net>'
-__version__ = '0.2'
+__version__ = '0.2.1'
__license__ = """
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -282,14 +282,18 @@ def do_put(self, line):
def do_delete(self, key):
''' delete <key>\t\tdelete entry by key '''
key = key.rstrip().lstrip()
- if self.__current_coll.get(key) <> (None, None):
- self.__current_coll.delete(key)
- self.__current_coll.commit()
- print 'Done'
+ try:
+ if self.__current_coll.get(key) <> (None, None):
+ self.__current_coll.delete(key)
+ self.__current_coll.commit()
+ print 'Done'
+ return
+ else:
+ print 'Error! The key %s does not exist' % key
+ return
+ except RuntimeError, err:
+ print 'Error!', err
return
- else:
- print 'Error! The key %s does not exist' % key
- return
# ----------------------------------
# main
Please sign in to comment.
Something went wrong with that request. Please try again.