[Zope] Using fpformat in python scrips; Was: Currency formatting from within Python Script

complaw@hal-pc.org complaw@hal-pc.org
Tue, 8 Jan 2002 22:43:58 GMT


Forget what I just wrote in the last response, bad idea.  Andreas was right.  It
is just better to do it the hard way.  

I wish there was a place in Zope where the administrator could select what set
of standard python modules that would be supported by scripts.  You know,
something with two boxes:  the set of unselected modules on the left, and the
set of selected modules on the right, with arrow buttons going each way.  Then
you would have a "restart" button to restart Zope and 'voila,' instant
gratification.

Just a thought...

Thanks for your help, everyone.

Ron



> Thanks Steve, that was indeed very simple.
> 
> However, I have stumbled across an seemingly strange (at first blush) issue. 
> There is a module called fpformat that will allow for floating point
formatting. 
> 
> fpfloat.py is /lib/python2.1/fpfloat.py
> 
> It is available to Products, but not to python scripts.  My question is, if I
do
> what Andreas says and have a product called FP, with a python file called
> fpfloat.py and an appropriate __init__.py script, will that interfere with
> anything?
> 
> Instead, what if I modified PythonScript.py and simply added "import fpfloat"
> (and restarted Zope)?
> 
> Ron
> 
> >  
> > > Is there an easier way to simply have a float display (round) to 
> > > two decimal
> > > places, rather than monkeying around with the access 
> > > restrictions?  I can add
> > > the '$' to the string.
> > 
> > print "$%9.2f"
> > return printed
> > 
> > 
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists - 
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
> > 
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>