plone / plone.app.event

Event content type for Plone
https://pypi.python.org/pypi/plone.app.event
Other
17 stars 37 forks source link

IEventBasic.start/end defaults are not written into the Object #252

Open bearpreis opened 7 years ago

bearpreis commented 7 years ago

Hi, Plone Version 5.0.5.

When creating a new Event and just entering title, contact name and contact email, but ignoring the start and end times it will create an object in the zodb without any start or end attributes. If you then lookup the events using the catalog you will find the start and end dates in the brain object but not in the zodb object itself.

This leads to unforseen circumstances, because every time you view the object it will tell you that it starts now (with zero minutes) and ends in an hour... it is wandering all the time.

What i expected was that it saves the defaults i saw in the form not only into the brain but also in the object itself.

Here is the example event we lookup using the get_event method with ret_mode=2:

result = get_events(self.context, start=start, ret_mode=2, expand=True, path='/'.join(self.context.getPhysicalPath()))
foo = [x for x in result if x.id == 'eventtest'][0]

ipdb> pp foo.__dict__
{'_Access_contents_information_Permission': ('Contributor',
                                             'Editor',
                                             'Manager',
                                             'Owner',
                                             'Site Administrator'),
 '_Change_portal_events_Permission': ('Editor',
                                      'Manager',
                                      'Owner',
                                      'Site Administrator'),
 '_Modify_portal_content_Permission': ('Editor',
                                       'Manager',
                                       'Owner',
                                       'Site Administrator'),
 '_View_Permission': ('Contributor',
                      'Editor',
                      'Manager',
                      'Owner',
                      'Site Administrator'),
 '__ac_local_roles__': {'myuser': ['Owner']},
 '__annotations__': <BTrees.OOBTree.OOBTree object at 0x7f9d3393a950>,
 '__provides__': <zope.interface.Provides object at 0x7f9d33bf08d0>,
 '_owner': (['myplone', 'acl_users'], 'myuser'),
 '_plone.uuid': '348f4be027ea4388b8ac4e711865cc4f',
 '_v__providedBy__': (1476715060.582746,
                      1469702558.3739538,
                      0,
                      8769572171917,
                      <implementedBy ?>),
 'cmf_uid': <Products.CMFUid.UniqueIdAnnotationTool.UniqueIdAnnotation object at 0x7f9d338ce668>,
 'contact_email': u'test@test.com',
 'contact_name': u'test',
 'creation_date': DateTime('2016/10/17 16:37:39.956548 GMT+2'),
 'creators': ('myuser',),
 'id': 'eventtest',
 'language': u'de-at',
 'location_id': 0,
 'modification_date': DateTime('2016/10/17 16:37:40.317872 GMT+2'),
 'portal_type': 'Event',
 'relatedItems': [],
 'rights': None,
 'text': None,
 'title': u'termintest',
 'version_id': 0,
 'workflow_history': {'intranet_workflow': ({'action': None, 'review_state': 'internal', 'comments': '', 'actor': 'myuser', 'time': DateTime('2016/10/17 16:37:40.013034 GMT+2')},)}}
ericof commented 6 years ago

Also facing this same issue. When accessing the start and end attributes of the object, it will return the current date, not the one indexed by the catalog

davisagli commented 6 years ago

Sounds related to the issue that was fixed in https://github.com/plone/plone.dexterity/pull/67 (which is released in plone.dexterity 2.5.1 and Plone 5.1rc1)

ericof commented 6 years ago

Confirmed, pinning plone.dexterity to 2.5.1 (on a Plone 5.0.x buildout) solves the problem