your right, i probably should seperate the hits better. <br>the module that contains my make_history function i did not want to have to create a store<br>for each time one of the functions operated, so i use the store of the object that i pass into it from my main thread.
<br>def do_some_thing_with_object( obj ):<br>&nbsp;&nbsp; store = Store.of(obj) <br><br>this allows me to use the store that was created in the main thread.<br><br>i will try again with renamed variables. Maybe the values are not maintained well because of the way i have them. Since the same store had a hit in it that represented a StatusHit and one that represented a HistoryHit.
<br><br>that kinda still wouldn&#39;t explain why raw is the only one that does not get updated.<br><br>but i am still new to a lot of this. <br><br>thanks<br><br>shawn<br><br>&nbsp;&nbsp; <br><br><br><div><span class="gmail_quote">
On 8/7/07, <b class="gmail_sendername">Adrian Klaver</b> &lt;<a href="mailto:aklaver@comcast.net">aklaver@comcast.net</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tuesday 07 August 2007 4:00 pm, shawn bright wrote:<br>&gt; ok, here is my new function:<br>&gt; def make_history(obj, function, s_time = &#39;none&#39;, sid=&#39;none&#39;,<br>&gt; switch=&#39;none&#39;): print &#39;\n\n make history&#39;
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; print &#39;found object %s&#39; % obj.monitor<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; print &#39;found raw = %s&#39; % obj.last_raw<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; print &#39;type of raw = %s&#39; % type(obj.last_raw)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; print &#39;found value = %s &#39; % 
obj.last_value<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; store = Store.of(obj)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; raw = float(obj.last_raw)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; hit = HistoryHit()<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; hit.monitor = obj.monitor<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; hit.raw = raw<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; hit.value = unicode(obj.last_value
)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; hit.function =&nbsp;&nbsp;unicode(function)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; if s_time == &#39;none&#39;: hit.s_date_time = datetime.datetime.now()<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; hit.date_time = datetime.datetime.now()<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; hit.sid, hit.switch = unicode(sid), unicode(switch)
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; store.add(hit)<br>&gt;<br>&gt; the print statments show me that in my test, the raw was a type float<br>&gt; before the line that makes it one.<br>&gt; but i left the line that makes it a float in there anyway.
<br>&gt; raw = float(hit.raw)<br>Alright, I am now officially lost. Where did this line come from? I see raw =<br>float(obj.last_raw) but not raw = float(hit.raw).<br>&gt; then later<br>&gt; hit.raw = raw<br>&gt;<br>&gt; but still, the only thing showing up in the history table is 0 ( the
<br>&gt; default )<br>&gt; and the DEBUG of the sql statement is still missing the raw as part of what<br>&gt; gets<br>&gt; INSERT INTO history..<br>&gt;<br>&gt; thanks<br>&gt; shawn<br>&gt;<br>I am still working out the semantics of storm so I am not sure what store =
<br>Store.of(obj) does and how that affects the store.add(hit) call later. If it<br>where me I would try store=Store(). Also we are not seeing all the code and<br>in your examples you call self.store before running make_history so it is
<br>entirely possible you need to drop the store assignment and just do<br>self.store.add(hit). Something else comes to mind, in your examples you<br>assign to hit for values going to StatusHit() and for values going to<br>
HistoryHit(). Having wrestled with name visibility before, I generally try to<br>create different names to make it easier to sort out where my values are<br>originating from i.e. status_hit,history_hit<br><br><br>Good luck,
<br>--<br>Adrian Klaver<br><a href="mailto:aklaver@comcast.net">aklaver@comcast.net</a><br></blockquote></div><br>