[Zope] dollars-and-cents display fails

Greg Fischer retheoff at gmail.com
Fri May 13 23:54:57 EDT 2005


ok, lots of testing, and I have found that this is related to Mysql 5.0.4.

I compiled and installed Mysql 5.0.0 and the problem does not exist. I
guess means that it started in 5.0.1 or higher.  I read through the
change logs and saw a couple of items related to float values on 5.0.3
and 5.0.4, but I dont have any idea if those are causing the issue.

So, I dont know where to go next.  I can post this info on the mysql
lists, but I only see the problem in Zope.  Python, or at least the
MysqlDA, retrieves the value just fine.  I only get the problem if
using a fmt option on Zope.
Here's a recap: 
-- I can use Zope 2.7.4 with Mysql 5.0.4 on Windows (using Egenix ODBC
DA) and there is no issue.
-- I can use Zope 2.7.3 with Mysql 5.0.0 on Linux (Zmysqlda 2.0.9b3,
Mysql-python1.2.0,Python 2.3.4) and there is no issue.
-- When using Zope 2.7.3 with same setup as before, but with Mysql
5.0.4, problem exists.
-- Zope 2.7.6 has same issue.

I tried doing a simple dtml:
<dtml-call "REQUEST.set('dec',10.23)">
<dtml-var dec><br>
<dtml-var dec fmt="dollars-and-cents"><br>

This works just fine.  But when pulling 'dec' from Mysql, dtml wont
render it if using fmt.

I dont have to use Mysql 5.x.  It's just that I already have the app
running on it, and I'd like to start testing the stored procedures and
other useful features.

Sorry for the long post.  I just want to give as much info as
possible.  Thank you for any help!

Greg



On 5/12/05, Greg Fischer <retheoff at gmail.com> wrote:
> Oh, it is a decimal(15,2) column.  (all of them are)  Just thought I'd
> mention everything too... Running Ubuntu 5.0.4, has the Python 2.4.1
> package installed, but I have Python 2.3.4 compiled and installed
> separately for Zope.  Zope is compiled with the --with-python flag.
> 
> Just tried your suggestion, commenting the 'conv[FIELD_TYPE.DECIMAL] =
> float' line, restart Zope, still have the issue.
> 
> So, I have the older Python, which I used to have.  I could try
> loading an older Zope, but what I might try is loading the MySQL
> 5.0.0, which I had before.  At least I can hopefully find out which is
> causing my problem.  However, I have Zope 2.7.4 with MySQL 5.0.4 and
> it works fine, but on Windows using the Egenix adapter.  Now, I cant
> remember what I had for the mysql-python version, it's on the other
> server at my clients site. (cant get to it right now)
> 
> I guess one of my main questions too is, would Zope be getting
> anything from the 2.4.1 Ubuntu packages that are installed if I
> compiled it with the 2.3.4 python?  (mysql-python is installed
> correctly on 2.3.4 too)
> 
> On 5/12/05, Andy Dustman <farcepest at gmail.com> wrote:
> > On 5/12/05, Greg Fischer <retheoff at gmail.com> wrote:
> > > Thanks Andy.  I do have those versions.  But Python is 2.3.5 because I
> > > didnt want to move to 2.4.x as I think I read something in the README
> > > for Zope stating it was not tested for compatibility. (right?)  I
> > > guess my thought is... Does 2.3.5 have the same issue as 2.4 regarding
> > > the decimals?  For now, I am just going to setup 2.3.4 and run with
> > > it.
> >
> > The Python decimal type is new in 2.4.
> >
> > I don't think you've actually said whether or not you are actually
> > using a DECIMAL column.
> >
> > I had forgotten that ZMySQLDA-2.0.9b3 always returns DECIMAL columns
> > as Python float. If you look in ZMySQLDA/db.py, you can see where it
> > does this in the DB class. You could try commenting this line out,
> > which will cause it to be returned as a string, and restarting Zope.
> > It's something to try, at least.
> > --
> > Computer interfaces should never be made of meat.
> > http://www.terrybisson.com/meat.html
> > _______________________________________________
> > Zope maillist  -  Zope at zope.org
> > http://mail.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://mail.zope.org/mailman/listinfo/zope-announce
> >  http://mail.zope.org/mailman/listinfo/zope-dev )
> >
> 
> --
> Greg Fischer
> 1st Byte Solutions
> http://www.1stbyte.com
> 


-- 
Greg Fischer
1st Byte Solutions
http://www.1stbyte.com


More information about the Zope mailing list