Exemplo n.º 1
0
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)
Exemplo n.º 2
0
 def field_object_name(self, o):
     try:
         return smart_text(get_object(o.model_id, o.object))
     except AssertionError:
         return smart_text(o.object)
Exemplo n.º 3
0
 def field_object_name(self, o):
     try:
         return unicode(get_object(o.model_id, o.object))
     except AssertionError:
         return unicode(o.object)
Exemplo n.º 4
0
 def get_object(self):
     """
     Return object instance
     :returns: Object instance or None
     """
     return get_object(self.model, self.object)