<div>Jamu:</div><div><br></div>Yes, testing also indicates that Date attrs were not serialized.<div>I will test other datatypes while I work on the appl code. <div>So this is the corrected code.<div><br></div><div><b>def encode_storm_object(object):</b></div>
<div><b>     if not hasattr(object, &quot;__storm_table__&quot;):</b></div><div><b>         raise TypeError(repr(object) + &quot; is not JSON serializable&quot;)</b></div><div><b><br></b></div><div><b>     result = {}</b></div>
<div><b>     cls_info = get_cls_info(object.__class__)</b></div><div><b>     for name in cls_info.attributes.iterkeys():</b></div><div><b>         value= getattr(object, name)</b></div><div><b>         if (&quot;&lt;type &#39;datetime.date&#39;&gt;&quot; == str(value.__class__)): </b></div>
<div><b>             value= str(value)</b></div><div><b>         result[name] = value</b></div><div><b>     return result</b></div><div><br></div><div><b>json_str = json.dumps(storm_obj, default=encode_storm_object)</b></div>
<div><br>Sorry, but the only way that worked was using the string &quot;<b>&lt;type &#39;datetime.date&#39;&gt;</b>&quot; to test the object class.</div><div>I tried using <b>isinstance(obj, &quot;datetime.date&quot;)</b> but did not work.</div>
<div>Maybe you have a better solution here to check the attr class ... I am new in Python :-(</div><div><br></div><div>Mario</div><div><br></div><div><div class="gmail_quote">2010/5/27 Jamu Kakar <span dir="ltr">&lt;<a href="mailto:jkakar@kakar.ca">jkakar@kakar.ca</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<div class="im"><br>
On Thu, May 27, 2010 at 11:08 PM, Mario Zito &lt;<a href="mailto:mazito@analyte.com">mazito@analyte.com</a>&gt; wrote:<br>
&gt; Ok, it works with VERY minor corrections:<br>
<br>
</div>Yeah, not testing is a great way to write code that doesn&#39;t<br>
work. ;)  Thanks for posting the fixes.<br>
<br>
Take care,<br>
<font color="#888888">J.<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Mario A. Zito<br>ANALYTE SRL<br>Parana 457, piso 2, of. &#39;A&#39;<br>(C1033AAI) Buenos Aires, Argentina<br>tel: (54-11) 5258-0205 int 138<br><a href="mailto:mazito@analyte.com">mazito@analyte.com</a><br>
<a href="http://www.analyte.com">www.analyte.com</a><br>
</div></div></div>