from .utils import connect_foirequest


def connect_campaign(sender, **kwargs):
    reference = kwargs.get('reference')
    if not reference:
        return
    parts = reference.split(':', 1)
    if len(parts) != 2:
        return
    namespace = parts[0]

    connect_foirequest(sender, namespace)

from .utils import connect_foirequest


def connect_campaign(sender, **kwargs):
    reference = kwargs.get('reference')
    if not reference:
        return
    if '@' in reference:
        parts = reference.split('@', 1)
    else:
        parts = reference.split(':', 1)
    if len(parts) != 2:
        return
    namespace = parts[0]

    connect_foirequest(sender, namespace)

Allow connecting froide_campaigns to campaign app
Allow connecting froide_campaigns to campaign app
  from .utils import connect_foirequest
  
  
  def connect_campaign(sender, **kwargs):
      reference = kwargs.get('reference')
      if not reference:
          return
+     if '@' in reference:
+         parts = reference.split('@', 1)
+     else:
-     parts = reference.split(':', 1)
+         parts = reference.split(':', 1)
      if len(parts) != 2:
          return
      namespace = parts[0]
  
      connect_foirequest(sender, namespace)
  
Allow connecting froide_campaigns to campaign app
## Code Before:
from .utils import connect_foirequest


def connect_campaign(sender, **kwargs):
    reference = kwargs.get('reference')
    if not reference:
        return
    parts = reference.split(':', 1)
    if len(parts) != 2:
        return
    namespace = parts[0]

    connect_foirequest(sender, namespace)

## Instruction:
Allow connecting froide_campaigns to campaign app
## Code After:
from .utils import connect_foirequest


def connect_campaign(sender, **kwargs):
    reference = kwargs.get('reference')
    if not reference:
        return
    if '@' in reference:
        parts = reference.split('@', 1)
    else:
        parts = reference.split(':', 1)
    if len(parts) != 2:
        return
    namespace = parts[0]

    connect_foirequest(sender, namespace)
