Exemple #1
0
	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
Exemple #2
0
			found_invalid_parm = True

			if attr in attr_locks:
				raise error(error.fail, "Locked attribute has invalid value",
						"attr: %s, error: %s" % (attr, e))
			elif attr in attr_to_lock:
				attr_to_lock.remove(attr)

	for attr in attr_locks:
		entity.get_attr(attr, p_action).lock()

	for attr in attr_to_lock:
		entity.get_attr(attr, p_action).to_lock()

	from germ.erm.helper import get_action
	action = get_action(p_action, do_exec and not found_invalid_parm)

	# o Check for errors/success
	# o Display type (form/view/listing)
	# o Get possible variables, like user id and such
	#
	# Display type: Form as long as there are missing parameters (PK for a
	# view, ...), view as soon as everything is okay, or a listing for
	# result sets

	# First, search for required locks (-> form). After that we still need
	# to find out if we are supposed to display the whole thing as form or
	# view/listing (distinguish view/listing by the number of result sets).
	#
	# As soon as the operation has succeeded, we display the result as a
	# view/listing (even for edit/delete/submit).