Here it is impossible to have an exception;   editmode = (kwargs.get('editmode') == 'edit') is enough