def __check_item(self, ent_str, act_str): from germ.erm.helper import get_entity entity = get_entity(ent_str, self._session, globals()) from germ.erm.helper import get_action action = get_action(act_str, False) from germ.error.error import error try: import cf if not cf.ht_check_items: from germ.error.do_not_exec import do_not_exec raise do_not_exec() entity.accept(action) except error, e: from germ.error.no_valid_keys import no_valid_keys from germ.error.perm_denied import perm_denied from germ.error.do_not_exec import do_not_exec from germ.error.missing_lock import missing_lock from germ.error.missing_pk_lock import missing_pk_lock if isinstance(e, no_valid_keys) or isinstance(e, perm_denied): self._hide += 1 return None elif not (isinstance(e, do_not_exec) or \ isinstance(e, missing_lock) or \ isinstance(e, missing_pk_lock)): import sys exctype, exc, tb = sys.exc_info() raise exctype, exc, tb
def execute(self, do_exec = True): # set default values self._set_default() # create reference groups missing_lock = self.__analyze() # Fill the table with existing values. For some actions, such as 'list' # or 'submit' this would not make any sense. if self.__fill_table: rec = self._tbl.get_rec() self._tbl._fill(rec, self.__act_str) # execute pre-action function self._tbl.pre(self.__act_str) if missing_lock and self.__raise_missing_lock: from germ.error.missing_lock import missing_lock raise missing_lock() if not do_exec: from germ.error.do_not_exec import do_not_exec raise do_not_exec() # execute SQL query self.__doit() # execute post-action function self._tbl.post(self.__act_str)
def check_exec(self, do_exec): if not do_exec: from germ.error.do_not_exec import do_not_exec raise do_not_exec()
from germ.error.do_not_exec import do_not_exec from germ.error.missing_lock import missing_lock from germ.error.missing_pk_lock import missing_pk_lock from germ.error.no_valid_keys import no_valid_keys from germ.error.perm_denied import perm_denied from germ.error.invalid_parm import invalid_parm if (isinstance(e, do_not_exec) or isinstance(e, invalid_parm)) \ and (not do_exec or found_invalid_parm): display_errors = False error_str = str(e) + "<BR />\n<BR />\n" if isinstance(e, missing_lock): if not do_exec: error_str = str(do_not_exec()) + "<BR />\n<BR />\n" elif isinstance(e, invalid_parm): pass elif isinstance(e, do_not_exec): pass elif isinstance(e, missing_pk_lock): prompt_pk_only = True elif isinstance(e, no_valid_keys) or isinstance(e, perm_denied): error(error.warn, e, "action: %s, entity: %s" % \ (p_action, p_entity)) return error_str else: import sys exctype, exc, tb = sys.exc_info() raise exctype, exc, tb