Please submit a ticket here -
http://bitbucket.org/chris1610/satchmo/issues?status=new

I'm much less likely to lose it if it's in the ticket system.

Thanks,
Chris

On Mon, Sep 13, 2010 at 10:25 PM, Howery <[email protected]> wrote:

> Thanks for the feed back. That helped a lot knowing that I hadn't
> broken something. I have updated the Newsletter listener.py and it now
> checks if the user is subscirbed if there is no newsletter info. As I
> am new to django and Satchmo (and am really enjoying working with
> them) I am not sure if there is somewhere I should post my fix other
> then here, so here is my updated listener.py for the Newsletter. If
> someone knows of a better way to write this, or where I should submit
> it please let me know.
>
>
> from satchmo_ext.newsletter import update_subscription
> from satchmo_ext.newsletter.models import Subscription
> from satchmo_store.contact.forms import ContactInfoForm
> from signals_ahoy.signals import collect_urls, form_postsave
> import logging
>
> log = logging.getLogger('newsletter.listeners')
>
> def contact_form_listener(sender, object=None, formdata=None,
> form=None, **kwargs):
>     if 'newsletter' not in formdata:
>         email = formdata['email']
>        if Subscription.email_is_subscribed(email):
>                subscribed = True
>        else:
>                 subscribed = False
>    else:
>        subscribed = formdata['newsletter']
>
>     log.debug('Updating newletter subscription for %s to %s', object,
> subscribed)
>    update_subscription(object, subscribed)
>
> def start_listening():
>    from urls import add_newsletter_urls
>    from satchmo_store import shop
>
>    form_postsave.connect(contact_form_listener,
> sender=ContactInfoForm)
>    collect_urls.connect(add_newsletter_urls, sender=shop)
>
>
> On Sep 6, 11:01 am, Chris Moffitt <[email protected]> wrote:
> > Sorry I'm late to responding to this. It's definitely a bug. My
> > recommendation would be to check if they are subscribed and then set the
> > variable based on that result.
> >
> > If you're still having trouble getting it to work, please open a ticket
> with
> > details and we'll see if we can figure out a good solution.
> >
> > -Chris
> >
> >
> >
> > On Tue, Aug 31, 2010 at 7:39 AM, Howery <[email protected]> wrote:
> > > After trying to track this down some more I have found out why it is
> > > unsubscribing from the newsletter, but not so much of how to stop it.
> >
> > > In the newsletter listener, the "contact_form_listener" has the
> > > following if statement:
> >
> > > if 'newsletter' not in formdata:
> > >        subscribed = False
> > >    else:
> > >        subscribed = formdata['newsletter']
> >
> > > There is not any newsletter in the form data from the first step of
> > > checkout where you verify addresses and such. So the listener is
> > > automatically setting the subscribed = False.
> >
> > > Would it be better to add the newsletter to the form data as a hidden
> > > field in the checkout process?? or to rewrite the listener to check if
> > > the email is already subscribed? perhaps with the
> > > newsletter.email_is_subscribed(cls, email) from the newsletter model?
> > > and then pass the results of that test? I have tried to do this, but
> > > couldn't get it to work. I am still trying to figure out how signals
> > > work in general.
> >
> > > Thanks for any help.
> >
> > > On Aug 28, 12:50 pm, Howery <[email protected]> wrote:
> > > > I've setup Satchmo to use Mailman for the newsletter. and it is
> > > > working fine. when the user updates their profile it will subscribe
> or
> > > > unsubscribe them correctly.
> > > > However I have found that when a user that checks out a shopping cart
> > > > it unsubscribes them from the newsletter. It happens when they
> confirm
> > > > their information before going to the select shipping step.
> >
> > > > Satchmo.log shows this:
> >
> > > > Sat, 28 Aug 2010 10:23:48 satchmo_store.contact.forms INFO
> Sending
> > > > form_init signal: <class 'payment.forms.PaymentContactInfoForm'>
> > > > Sat, 28 Aug 2010 10:23:49 satchmo_store.contact.forms DEBUG    Saving
> > > > contact info for David Howery
> > > > Sat, 28 Aug 2010 10:23:49 newsletter.listeners DEBUG    Updating
> > > > newletter subscription for David Howery to False
> > > > Sat, 28 Aug 2010 10:23:49 newsletter   DEBUG    Updating subscription
> > > > status from True to False for David Howery
> >
> > > > I am at a loss on how to stop it from triggering the newsletter
> status
> > > > change. Any suggestions?
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Satchmo users" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<satchmo-users%[email protected]>
> <satchmo-users%2bunsubscr...@goog legroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/satchmo-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Satchmo users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<satchmo-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/satchmo-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Satchmo users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/satchmo-users?hl=en.

Reply via email to