[Grok-dev] Grok & Annoying time problem

Marcel Klapschus battlefox at gmail.com
Tue Aug 10 02:47:10 EDT 2010


I have a simple Grok AddForm with a date-field that is supposed to have the
current date as default value. 
Something like this:

currentdate = zope.schema.Date(
                      title=  u'currentdate',
                      default= datetime.date.today(),

The date-field is supposed to accept currentdate and all prior dates. So I
add to setupwidgets:

    def setUpWidgets(self, ignore_request=False):
        self.form_fields['currentdate'].field.max = datetime.date.today()


Here is where the problem begins: While the default value for "currenttdate"
is correctly updated every day I load the form, the
"self.form_fields['currentdate'].field.max"-value is not updated at all. It
keeps the date from the last zope-server start. 

An example:

- Zope Server started on August 9th
- Form loaded on August 10th with correct currentdate
- After sending the form my application crashes:

  Module zope.schema._bootstrapfields, line 246, in _validate
    raise TooBig(value, self.max)
TooBig: (datetime.date(2010, 8, 10), datetime.date(2010, 8, 9))

Is there a reason why self.form_fields['currentdate'].field.max is only
updated at server-restart and not by sending the form?


Any idea what's going wrong here?
-- 
View this message in context: http://old.nabble.com/Grok---Annoying-time-problem-tp29394781p29394781.html
Sent from the Grok mailing list archive at Nabble.com.



More information about the Grok-dev mailing list