def get_obj(self, context):
        if self.model and self.lookup:
            if isinstance(self.lookup[1], template.Variable):
                try:
                    lookup_val = self.lookup[1].resolve(context)
                except template.VariableDoesNotExist, e:
                    log.warning('BoxNode: Template variable does not exist. var_name=%s', self.lookup[1].var)
                    raise ObjectNotFoundOrInvalid()

            else:
                lookup_val = self.lookup[1]

            try:
                obj = get_cached_object(self.model, **{self.lookup[0] : lookup_val})
            except (models.ObjectDoesNotExist, __HOLE__), e:
                log.warning('BoxNode: %s (%s : %s)', str(e), self.lookup[0], lookup_val)
                raise ObjectNotFoundOrInvalid()
        else:
            try:
                obj = self.var.resolve(context)
            except template.VariableDoesNotExist, e:
                log.warning('BoxNode: Template variable does not exist. var_name=%s', self.var.var)
                raise ObjectNotFoundOrInvalid()

            if not obj:
                raise ObjectNotFoundOrInvalid()
        return obj
dataset/ETHPy150Open ella/ella/ella/core/templatetags/core.py/BoxNode.get_obj