Rename a shortcut

def action_rename(self):
        """
        Rename a shortcut
        """

        # get old and new name from args
        old = self.args['<old>']
        new = self.args['<new>']

        # select the old shortcut
        self.db_query('''
            SELECT id FROM shortcuts WHERE name=?
            ''', (old,))
        r = self.db_fetch_one()

        # error if old doesn't exist
        if r == None:
            print_err('Shortcut "%s" does not exist!' % old)
            return

        # error if new exists
        if self.shortcut_exists(new):
            print_err('Shortcut "%s" already exists!' % new)
            return

        id = r[0]

        # rename in DB
        self.db_exec('''
            UPDATE shortcuts SET name=? WHERE id=?
            ''', (new, id))

        # show OK message
        print_msg('Shortcut "%s" renamed to "%s".' % (old, new))