Skip to content

Commit

Permalink
rename modified to modification_date and created to creation_date
Browse files Browse the repository at this point in the history
  • Loading branch information
vangheem committed Apr 10, 2017
1 parent 0795a5b commit feb73c5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
1.0.0a7 (unreleased)
--------------------

- Nothing changed yet.
- rename modified to modification_date and created to creation_date
[vangheem]


1.0.0a6 (2017-04-06)
Expand Down
15 changes: 8 additions & 7 deletions guillotina/behaviors/dublincore.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ class IDublinCore(Interface):
title=u'Description',
description=u"The first unqualified Dublin Core 'Description' element value.")

created = schema.Datetime(
creation_date = schema.Datetime(
title=u'Creation Date',
description=u"The date and time that an object is created. "
u"\nThis is normally set automatically.")

modified = schema.Datetime(
modification_date = schema.Datetime(
title=u'Modification Date',
description=u"The date and time that the object was last modified in a\n"
u"meaningful way.")

effective = schema.Datetime(
effective_date = schema.Datetime(
title=u'Effective Date',
description=u"The date and time that an object should be published. ")

expires = schema.Datetime(
expiration_date = schema.Datetime(
title=u'Expiration Date',
description=u"The date and time that the object should become unpublished.")

Expand Down Expand Up @@ -86,11 +86,12 @@ class DublinCore(AnnotationBehavior):

creators = ContextProperty(u'creators', ())
contributors = ContextProperty(u'contributors', ())
created = ContextProperty(u'created', None)
modified = ContextProperty(u'modified', None)
creation_date = ContextProperty(u'creation_date', None)
modification_date = ContextProperty(u'modification_date', None)

# all properties but these 4 are not annotated
__local__properties__ = ('creators', 'contributors', 'created', 'modified')
__local__properties__ = ('creators', 'contributors', 'creation_date',
'modification_date')

def __init__(self, context):
self.__dict__['context'] = context
Expand Down
4 changes: 2 additions & 2 deletions guillotina/catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
index.apply(IResource, 'uuid', type='keyword')
index.apply(IResource, 'type_name', type='keyword')
index.apply(IResource, 'title')
index.apply(IResource, 'modified', type='date')
index.apply(IResource, 'created', type='date')
index.apply(IResource, 'modification_date', type='date')
index.apply(IResource, 'creation_date', type='date')


@index.with_accessor(IResource, 'access_roles', type='keyword')
Expand Down
8 changes: 4 additions & 4 deletions guillotina/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def __call__(self, id, *args, **kw):
obj = super(ResourceFactory, self).__call__(*args, **kw)
obj.type_name = self.type_name
now = datetime.now(tz=_zone)
obj.created = now
obj.modified = now
obj.creation_date = now
obj.modification_date = now
if id is None:
if obj._p_oid is None:
# uuid uses _p_oid...
Expand Down Expand Up @@ -289,8 +289,8 @@ class Resource(guillotina.db.orm.base.BaseObject):
__acl__ = None

type_name = None
created = None
modified = None
creation_date = None
modification_date = None
title = None

@property
Expand Down
2 changes: 1 addition & 1 deletion guillotina/json/serialize_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def __call__(self):
'@id': IAbsoluteURL(self.context, self.request)(),
'@type': self.context.type_name,
'parent': parent_summary,
'created': json_compatible(self.context.created),
'creation_date': json_compatible(self.context.creation_date),
'modified': json_compatible(self.context.modified),
'UID': self.context.uuid,
}
Expand Down
8 changes: 4 additions & 4 deletions guillotina/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ async def test_create_contenttype_with_date(container_requester):
'/db/guillotina/item1',
data=json.dumps({
"guillotina.behaviors.dublincore.IDublinCore": {
"created": date_to_test,
"expires": date_to_test
"creation_date": date_to_test,
"expiration_date": date_to_test
}
})
)
Expand All @@ -180,8 +180,8 @@ async def test_create_contenttype_with_date(container_requester):
from guillotina.behaviors.dublincore import IDublinCore
behavior = IDublinCore(obj)
await behavior.load()
assert behavior.created.isoformat() == date_to_test
assert behavior.expires.isoformat() == date_to_test
assert behavior.creation_date.isoformat() == date_to_test
assert behavior.expiration_date.isoformat() == date_to_test


async def test_create_duplicate_id(container_requester):
Expand Down

0 comments on commit feb73c5

Please sign in to comment.