I'll tyr and branch our code and do so e digging with our work around  
removed.  Pehaps even setup a repo for you to checkout if you wish.
Sorry if this ema is all on one line, my iPod is acting up.

Sent from my iPod

On Oct 25, 2009, at 12:48 AM, Bob Waycott <[email protected]> wrote:

> Ryan,
>
> I'd sure like to see what was going on with some heavy logging to  
> see how your method was being called twice via the order_success  
> signal, as our entire store relies on that signal in all cases for  
> various types of custom processing, and I have not seen or heard  
> anything since we launched to indicate it is being called twice.
>
> Do you have sender defined in your connect()? That is:
>
> order_success.connect(listener_function, sender=None)
>
> If the signal is actually firing twice, this must be a bug, and we  
> should certainly figure out why/where it is happening. Too many  
> stores, imo, would want to depend on this signal to allow a bug not  
> to be found. I can't duplicate it over here.
>
> Best,
>
> Bob
>
> On Fri, Oct 23, 2009 at 10:58 PM, Ryan Headley  
> <[email protected]> wrote:
> Okay...your confused?? lol, so am i so lets first talk semantics.   
> When I say CustomProduct, Im not talkng about  
> product.models.CustomProduct...quite literally I mean:
>
> class MyProduct(Product):
>     my custom fields here
>
> When MyProduct is added to an order we discovered order_sucess was  
> firing twice.  (We spit out an xml representation of the order to  
> the filesystem for retrieval by an SAP backend, and for each order  
> we were getting two files).  Through various troubleshooting methods  
> and some logging we were able to verify that order_sucess was  
> getting fired twice.
>
> Chris pointed me to the order_success method of DownloadableProduct  
> and that same spot of code you mention (line 917 or so).  This led  
> me to believe that if i created a method on MyProduct called  
> order_success, that this method would be the action that gets called  
> when order_success gets fired.  However, nothin we did would get the  
> code in that method to run.
>
> In would agree that it appears our MyProduct is not being recognized  
> as a subtype..so we abandoned that idea.  This is what our signal  
> code looks like.  (its been placed at the bottom of models.py in oru  
> main app:
>
> def sap_export(sender, **kwargs):
>    our code here
> order_success.connect(sap_export) # register the handler
>
> We've added code to work around our issue in the sap_export method.
> It appeared to us that our sap_export method was getting called  
> twice for each order.
>
>
>
>
> Hope that clears up our issue -- let me know if you want more info.
>
>
>
>
> On Fri, Oct 23, 2009 at 5:06 PM, Bob Waycott <[email protected]>  
> wrote:
> My assumption as to why the signal got called twice was that is was  
> calling it once for the Parent product (Satchmo's model) and once  
> for our Child Product (the inherited Product).  My other assumption  
> (and this could be way off) was that had I done it the way Satchmo  
> intends it to be done, that our subtype product would have been  
> found and THAT model's order_success method would have run.  (for  
> reference, here is the link to the discussion I had with Chris:  
> http://groups.google.com/group/satchmo-users/browse_thread/thread/6f88be5a09bb6f41/6cd1799fd3c823f4?hl=en&lnk=gst&q=signal+called+twice#6cd1799fd3c823f4
>  
> )
>
>
> Ryan (and Chris):
>
> I think I'm confused here.
>
> Sounds to me like Ryan's custom order_success method wasn't called  
> because his CustomProduct wasn't being picked up as a subtype, given  
> what I see in the code for the Order.order_success() method (lines  
> 917-925).
>
> Ryan, if your goal was to have your custom order_success() method  
> picked up at this point, then wouldn't we want to troubleshoot/ 
> define how a CustomProduct via model inheritance gets picked up as a  
> subtype via the call to `orderitem.product.get_subtype_with_attr 
> ('order_success')`?
>
> However, listening to the order_success SIGNAL sent via the Order  
> object is a different matter entirely, from how I'm reading the code  
> (and I could very well be wrong). An Order is a unique object. It  
> should send the SIGNAL once and only once. If it is sending the  
> signal more than once, then there must be a bug somewhere that is  
> causing Order.order_success() to be called more than once -- as this  
> is the method that sends the Order.order_success signal.
>
> From how I read the code, this is the workflow (in pseudocode and/or  
> plain English) of Order.order_success():
>
> log "Order Success"
> execute order_success() method for every Product.sub_type that  
> defines an order_sucess() method of its own
> send order_success SIGNAL
>
> Given this expected workflow, it has to be a bug if the signal is  
> sent more than once.
>
> Now, if the problem is the order_success() method is not called,  
> then it seems to me the problem is that your custom product is not  
> being recognized as a valid subtype?
>
>
>
>
>
> -- 
> http://www.sudovi.com/
> http://www.twitter.com/lifewithryan
> http://www.thecommontongue.com
> http://www.lifewithryan.com/
>
>
>
>
> >

--~--~---------~--~----~------------~-------~--~----~
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