Sets CRM profile state (active/inactive) for deals.
import logging
from django.db import transaction
from termcolor import colored
from openoutreach.crm.models import DealState
logger = logging.getLogger(__name__)
# Keep in sync with DealState: every state a Deal can transition *into* needs an
# entry here, or set_profile_state falls back to a red "ERROR" label (see below).
# NO_EMAIL_BETTERCONTACT is an enrichment miss (provider found no address) โ an
# expected terminal, not an operational error, so it renders muted yellow.
# UNSUBSCRIBED is the same kind of event one step later (the recipient ended the
# reachability rather than the provider) and renders the same way.
_STATE_LOG_STYLE = {
DealState.QUALIFIED: ("QUALIFIED", "green", []),
DealState.READY_TO_FIND_EMAIL: ("READY_TO_FIND_EMAIL", "yellow", ["bold"]),
DealState.
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key