Exemplo n.º 1
0
    return result


def update_subscription_listener(contact=None, subscribed=False, **kwargs):
    if contact:
        update_subscription(contact, subscribed)


def populate_form_initialdata_listener(contact=None, initial={}, **kwargs):
    if contact:
        current_subscriber = is_subscribed(contact)
    else:
        current_subscriber = False

    initial['newsletter'] = current_subscriber


def view_user_data_listener(contact=None, contact_dict=None, **kwargs):
    module = config_value('NEWSLETTER', 'MODULE')
    if module not in ('', 'satchmo_ext.newsletter.ignore'):
        contact_dict['show_newsletter'] = True
        contact_dict['newsletter'] = is_subscribed(contact)
    else:
        contact_dict['show_newsletter'] = False


satchmo_contact_view.connect(view_user_data_listener, sender=None)
satchmo_registration.connect(update_subscription_listener, sender=None)
form_initialdata.connect(populate_form_initialdata_listener,
                         sender='RegistrationForm')
Exemplo n.º 2
0
from satchmo_store.shop.signals import order_success, order_cancelled, satchmo_order_status_changed
from satchmo_store.accounts.signals import satchmo_registration
from satchmo_store.shop.models import Order
from satchmo_store.accounts.forms import RegistrationForm
from satchmo_store import shop
from signals_ahoy.signals import collect_urls

from reward.listeners import *
from reward.urls import add_reward_urls

log = logging.getLogger('rewards.listeners')

log.debug("Adding reward listeners")

satchmo_registration.connect(create_reward_listener, sender=None)
satchmo_order_status_changed.connect(rcv_order_status_changed, sender=None)
#order_cancelled.connect(remove_points, sender=None)
order_success.connect(add_points_on_order, sender=None)


collect_urls.connect(add_reward_urls, sender=shop)
Exemplo n.º 3
0
    current = is_subscribed(contact)
    log.debug("Updating subscription status from %s to %s for %s", current, subscribed, contact)
    result = get_newsletter_module().update_contact(contact, subscribed, attributes=attributes)
    signals.newsletter_subscription_updated.send(contact, 
        old_state=current, new_state=subscribed, contact=contact, attributes=attributes)
    return result

def update_subscription_listener(contact=None, subscribed=False, **kwargs):
    if contact:
        update_subscription(contact, subscribed)

def populate_form_initialdata_listener(contact=None, initial = {}, **kwargs):
    if contact:
        current_subscriber = is_subscribed(contact)
    else:
        current_subscriber = False

    initial['newsletter'] = current_subscriber

def view_user_data_listener(contact=None, contact_dict=None, **kwargs):
    module = config_value('NEWSLETTER', 'MODULE')
    if module not in ('', 'satchmo_ext.newsletter.ignore'):
        contact_dict['show_newsletter'] = True
        contact_dict['newsletter'] = is_subscribed(contact)
    else:
        contact_dict['show_newsletter'] = False

satchmo_contact_view.connect(view_user_data_listener, sender=None)
satchmo_registration.connect(update_subscription_listener, sender=None)
form_initialdata.connect(populate_form_initialdata_listener, sender='RegistrationForm')
Exemplo n.º 4
0
from satchmo_store.shop.signals import order_success, order_cancelled, satchmo_order_status_changed
from satchmo_store.accounts.signals import satchmo_registration
from satchmo_store.shop.models import Order
from satchmo_store.accounts.forms import RegistrationForm
from satchmo_store import shop
from signals_ahoy.signals import collect_urls

from reward.listeners import *
from reward.urls import add_reward_urls

log = logging.getLogger('rewards.listeners')

log.debug("Adding reward listeners")

satchmo_registration.connect(create_reward_listener, sender=None)
satchmo_order_status_changed.connect(rcv_order_status_changed, sender=None)
#order_cancelled.connect(remove_points, sender=None)
order_success.connect(add_points_on_order, sender=None)

collect_urls.connect(add_reward_urls, sender=shop)