Re: [Zope3-Users] Time for a Decimal field type in zope.schema?

2006-08-31 Thread Marius Gedminas
On Fri, 7 Apr 2006 09:37:02 -0400
Gary Poster <[EMAIL PROTECTED]> wrote:

> On Apr 7, 2006, at 8:35 AM, Jeff Rush wrote:
> > Perhaps this is an old topic, although I've done searches.  I've  
> > seen the brief discussion about security proxies and the Decimal  
> > type on zope3-users, but (to zope3-dev) what about getting it added  
> > to the zope.schema as a first-class field type?  So we can have  
> > auto-generated HTML forms and such?
> >
> > Has anyone already done this, in some Zope3 branch or private  
> > development?
> 
> Not as far as I know.
> 
> > If not, is there any good reason it should not happen?  Must Zope3  
> > support Python versions prior to the introduction of the Decimal type?
> 
> Not as far as I know.
> 
> > I'm willing to tackle it and make a submission, otherwise.
> 
> +1

I am going to work on this today.

Marius Gedminas
-- 
You can't spell evil without vi.


pgp92jSDRH66d.pgp
Description: PGP signature
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Time for a Decimal field type in zope.schema?

2006-08-31 Thread Darryl Cousins
Hi,

For what it may be worth, a Decimal field:

Code:
http://projects.treefernwebservices.co.nz/tfws.org.nz/file/trunk/src/tfws/field/field.py
Doctest:
http://www.tfws.org.nz/tfws.field.README.html

And a currency type which uses it:

Code:
http://projects.treefernwebservices.co.nz/tfws.org.nz/file/trunk/src/tfws/currency/app.py
Doctest:
http://www.tfws.org.nz/tfws.currency.README.currency.html

Courteous thanks to plonemall.

Sincere regards,
Darryl


On Thu, 2006-08-31 at 15:07 +0300, Marius Gedminas wrote:
> On Fri, 7 Apr 2006 09:37:02 -0400
> Gary Poster <[EMAIL PROTECTED]> wrote:
> 
> > On Apr 7, 2006, at 8:35 AM, Jeff Rush wrote:
> > > Perhaps this is an old topic, although I've done searches.  I've  
> > > seen the brief discussion about security proxies and the Decimal  
> > > type on zope3-users, but (to zope3-dev) what about getting it added  
> > > to the zope.schema as a first-class field type?  So we can have  
> > > auto-generated HTML forms and such?
> > >
> > > Has anyone already done this, in some Zope3 branch or private  
> > > development?
> > 
> > Not as far as I know.
> > 
> > > If not, is there any good reason it should not happen?  Must Zope3  
> > > support Python versions prior to the introduction of the Decimal type?
> > 
> > Not as far as I know.
> > 
> > > I'm willing to tackle it and make a submission, otherwise.
> > 
> > +1
> 
> I am going to work on this today.
> 
> Marius Gedminas
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Time for a Decimal field type in zope.schema?

2006-08-31 Thread Marius Gedminas
On Thu, 31 Aug 2006 20:29:49 +0700 Darryl Cousins
<[EMAIL PROTECTED]> wrote:
> On Thu, 2006-08-31 at 15:07 +0300, Marius Gedminas wrote:
> > I am going to work on this today.
>
> For what it may be worth, a Decimal field:
> 
> Code:
> http://projects.treefernwebservices.co.nz/tfws.org.nz/file/trunk/src/tfws/field/field.py
> Doctest:
> http://www.tfws.org.nz/tfws.field.README.html

Looks nice.  Would you consider contributing it for the inclusion into the
Zope 3 core?  (I see that it is already licenced under the ZPL, but I do
not think I can just commit it into the Zope 3 repository under a different
name.)

I am attaching the diff showing my current working version, which mirrors
the existing zope.schema.Float field more closely.  As far as I can tell
your field/widget is better.  The only thing I do not see is a registration
for a IDisplayWidget.

Marius Gedminas
-- 
Think different? I'd be happy if most people would just think...


zope3-decimal-field-and-widget.patch
Description: Binary data


pgpThoaGyHTMB.pgp
Description: PGP signature
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Time for a Decimal field type in zope.schema?

2006-08-31 Thread Lennart Regebro

On 8/31/06, Darryl Cousins <[EMAIL PROTECTED]> wrote:

Hi,

For what it may be worth, a Decimal field:


Just a note: The format should be localized. In some countries "0,01" is used.
(yes, a comma).
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: Time for a Decimal field type in zope.schema?

2006-08-31 Thread Philipp von Weitershausen
Lennart Regebro wrote:
> On 8/31/06, Darryl Cousins
> <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> For what it may be worth, a Decimal field:
> 
> Just a note: The format should be localized. In some countries "0,01" is
> used. (yes, a comma).

I think you're confusing format and precision. Format is a rendering
issue that heavily depends on the request or other language-sensitive
contexts. We have the zope.i18n.locales machinery for that. It already
covers the comma-vs-point problem.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Time for a Decimal field type in zope.schema?

2006-08-31 Thread Marius Gedminas
On Thu, 31 Aug 2006 19:18:56 +0300 Marius Gedminas <[EMAIL PROTECTED]> wrote:
> On Thu, 31 Aug 2006 20:29:49 +0700 Darryl Cousins
> <[EMAIL PROTECTED]> wrote:
> > On Thu, 2006-08-31 at 15:07 +0300, Marius Gedminas wrote:
> > > I am going to work on this today.
> >
> > For what it may be worth, a Decimal field:
> > 
> > Code:
> > http://projects.treefernwebservices.co.nz/tfws.org.nz/file/trunk/src/tfws/field/field.py
> > Doctest:
> > http://www.tfws.org.nz/tfws.field.README.html
> 
> Looks nice.  Would you consider contributing it for the inclusion into the
> Zope 3 core?  (I see that it is already licenced under the ZPL, but I do
> not think I can just commit it into the Zope 3 repository under a different
> name.)

I committed my version (somewhat changed from the diff I posted here) into
Zope 3 trunk.  Feel free to update zope.schema.Decimal with features from
your widget that my version doesn't have (like normalization to a given
number of decimal points).

reinventing-the-bicycle-proudly
Marius Gedminas
-- 
Writing setattr hooks properly is a black art. Writing persistent
setattr hooks is more like hearding bees blindfolded...
-- Casey Duncan


pgpzMeMDRej9v.pgp
Description: PGP signature
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Time for a Decimal field type in zope.schema?

2006-08-31 Thread Darryl Cousins
Hi Marius,

Cheers. I don't have checkin rights so I'll leave it to you (or another)
if it considered is worthwhile.

Sincere regards,
Darryl.

On Fri, 2006-09-01 at 00:21 +0300, Marius Gedminas wrote:
> I committed my version (somewhat changed from the diff I posted here)
> into
> Zope 3 trunk.  Feel free to update zope.schema.Decimal with features
> from
> your widget that my version doesn't have (like normalization to a
> given
> number of decimal points).
> 
> reinventing-the-bicycle-proudly
> Marius Gedminas 

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Time for a Decimal field type in zope.schema?

2006-08-31 Thread Darryl Cousins
Hi,

Yes, I am aware of the use of a comma as a decimal place indicator, but
was unsure how to handle it. Thanks Philipp for the hint.

Sincere regards,
Darryl

On Thu, 2006-08-31 at 19:03 +0200, Philipp von Weitershausen wrote:
> > Just a note: The format should be localized. In some countries
> "0,01" is
> > used. (yes, a comma).
> 
> I think you're confusing format and precision. Format is a rendering
> issue that heavily depends on the request or other language-sensitive
> contexts. We have the zope.i18n.locales machinery for that. It already
> covers the comma-vs-point problem. 


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users