def state_job(handler, model, object): """ State.job_handler wrapper :param handler: :param model: :param object: :return: """ # Resolve handler h = get_handler(handler) if not h: logger.error("Invalid handler %s", handler) return # Resolve object obj = get_object(model, object) if not obj: logger.error("Cannot dereference %s:%s", model, object) # Call handler h(obj)
def field_object_name(self, o): try: return smart_text(get_object(o.model_id, o.object)) except AssertionError: return smart_text(o.object)
def field_object_name(self, o): try: return unicode(get_object(o.model_id, o.object)) except AssertionError: return unicode(o.object)
def get_object(self): """ Return object instance :returns: Object instance or None """ return get_object(self.model, self.object)