Hallo everybody
I have a question about DateRecurringIndex:
http://bluedynamics.com/articles/jens/daterecurringindex
I have used DateRecurringIndex for a custom event type.
The event type has additional "delta" and "until" fields (for the interval
and the date until which the date should recur):
atapi.IntegerField('delta',
required = False,
searchable = False,
languageIndependent = True,
vocabulary = 'getIntervals',
widget = atapi.SelectionWidget(
format = 'select',
i18n_domain = 'ftw.eventcalendar',
label = _(u'Interval'),
description = _(u'If this is a recurring event, please provide
the interval'),
),
),
atapi.DateTimeField('until',
required = False,
searchable = False,
accessor = 'until',
storage = atapi.AnnotationStorage(),
default_method = DateTime,
languageIndependent = True,
widget = atapi.CalendarWidget(i18n_domain ='ftw.eventcalendar',
label = _(u'Until'),
description = _(u'help_event_until',
default=u''),
),
),
In the catalog I have changed "start" and "end" to use DateRecurringIndex,
and for this index I have specified
the following for "start':
attribute date start: start
attribute delta in minutes: delta
attribute date until: until
dst behaviour: auto
and the following for "end":
attribute date start: end
attribute delta in minutes: delta
attribute date until: until
dst behaviour: auto
This all works very well, and the indexed value for "start" and "end" in the
catalog is a list of integers that looks something like this:
IISet([1076951040, 1076961120, 1076971200])
These I can then convert into DateTime objects again like so:
date_indexes = self.portal_catalog.Indexes['start'].getEntryForObject(rid)
for d_index in date_indexes:
year = d_index / 535680
month = (d_index / 44640 ) % 12
if month == 0:
month = 12;
year = year - 1
day = (d_index / 1440 ) % 31
if day == 0:
day = 31
month = month - 1
hour = (d_index / 60 ) % 24
minute = (d_index ) % 60
d_value = DateTime(year, month, day, hour, minute, 0, 'UTC')
And so I can verify that I have a nice list of recurring start and end dates
with for example a weekly interval:
start: 1076950920 --- (2010, 5, 7, 14, 0, 0, 'UTC') --- 2010/05/07
14:00:00 UTC --- Friday
end: 1076951040 --- (2010, 5, 7, 16, 0, 0, 'UTC') --- 2010/05/07
16:00:00 UTC --- Friday
start: 1076961000 --- (2010, 5, 14, 14, 0, 0, 'UTC') --- 2010/05/14
14:00:00 UTC --- Friday
end: 1076961120 --- (2010, 5, 14, 16, 0, 0, 'UTC') --- 2010/05/14
16:00:00 UTC --- Friday
start: 1076971080 --- (2010, 5, 21, 14, 0, 0, 'UTC') --- 2010/05/21
14:00:00 UTC --- Friday
end: 1076971200 --- (2010, 5, 21, 16, 0, 0, 'UTC') --- 2010/05/21
16:00:00 UTC --- Friday
My only problem is this:
When I change the values for "delta" and "until" on the object and save it,
the indexed lists of recurring dates are not modified.
Reindexing the "start" and "end" indexes also have no effect.
Only when I update the whole catalog, do I get updated date lists.
Am I providing enough information, and what am I missing?
Any help would be appreciated!
Thanks!
Arno Blumer
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers