You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
page_ordinal=zope.schema.Int(
title=_(u'Ordinal'),
description=_(u'Order of the pages'),
default=0,
missing_value=0, #don't know why this doesn't work
)
The error is as follows:
ConfigurationError: ('Invalid value for', 'class', "(None, (<type 'int'>, <type 'long'>))")
I've looked briefly at this error. The error is raised because the defaults for min_value and max_value are both None. This fails type checking, because None is not an int or a long. When missing_value is None, type checking is skipped.
I have to admit that I do not understand the semantics of missing_value.
I think that Int should allow min_value and max_value to be None regardless of the missing_value setting. Nones should be treated as minus infinity and plus infinity respectively.
As I understand it, the value of missing_value is supposed to be used when the submitted form-field is empty. As opposed to default_value, which is supposed to pre-populate the form field.
That's how it seems to me too. I looked briefly at the widget tests and couldn't figure out how to test it, so will have to look later (unless someone beats me to it, hint, hint).
The text was updated successfully, but these errors were encountered:
Fixes#9
Note that you must still specify a `default` in that case. I'm not
sure that makes sense or not.
This impacts Int, Float, Decimal, DateTime, Timedelta, Date, and
Time---all the subclasses of Orderable. They all have a test case.
Also fix ValidatedProperty and DefaultProperty to do the right thing
when accessesd on the class and not the instance (which is to return
themself; previously they would raise AttributeError).
In https://bugs.launchpad.net/zope.schema/+bug/98479, @webmaven reported:
@mgedmin followed-up:
@webmaven replied:
@benji-york opined:
The text was updated successfully, but these errors were encountered: