From feccaa435119f72874bbeb63fcb44cc2ab9e338d Mon Sep 17 00:00:00 2001 From: vangheem Date: Mon, 10 Apr 2017 01:41:15 -0500 Subject: [PATCH] rename modified to modification_date and created to creation_date --- CHANGELOG.rst | 3 ++- guillotina/behaviors/dublincore.py | 15 ++++++++------- guillotina/catalog/__init__.py | 4 ++-- guillotina/content.py | 8 ++++---- guillotina/json/serialize_content.py | 4 ++-- guillotina/subscribers.py | 2 +- guillotina/tests/test_api.py | 8 ++++---- guillotina/tests/test_catalog.py | 2 +- guillotina/tests/test_jsonschema.py | 2 +- guillotina/tests/utils.py | 5 ++++- 10 files changed, 29 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 41adc4417..c9b837940 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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) diff --git a/guillotina/behaviors/dublincore.py b/guillotina/behaviors/dublincore.py index 645e7e4b6..9ab8e4c5c 100644 --- a/guillotina/behaviors/dublincore.py +++ b/guillotina/behaviors/dublincore.py @@ -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.") @@ -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 diff --git a/guillotina/catalog/__init__.py b/guillotina/catalog/__init__.py index aa7d6b98c..1becaf2ae 100644 --- a/guillotina/catalog/__init__.py +++ b/guillotina/catalog/__init__.py @@ -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') diff --git a/guillotina/content.py b/guillotina/content.py index 542a63013..372981ae0 100644 --- a/guillotina/content.py +++ b/guillotina/content.py @@ -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... @@ -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 diff --git a/guillotina/json/serialize_content.py b/guillotina/json/serialize_content.py index dfd5371ed..45f8b9363 100644 --- a/guillotina/json/serialize_content.py +++ b/guillotina/json/serialize_content.py @@ -50,8 +50,8 @@ async def __call__(self): '@id': IAbsoluteURL(self.context, self.request)(), '@type': self.context.type_name, 'parent': parent_summary, - 'created': json_compatible(self.context.created), - 'modified': json_compatible(self.context.modified), + 'creation_date': json_compatible(self.context.creation_date), + 'modification_date': json_compatible(self.context.modification_date), 'UID': self.context.uuid, } diff --git a/guillotina/subscribers.py b/guillotina/subscribers.py index 59b0b130c..c285a4618 100644 --- a/guillotina/subscribers.py +++ b/guillotina/subscribers.py @@ -16,7 +16,7 @@ def modified_object(obj, event): """Set the modification date of an object.""" now = datetime.now(tz=_zone) - obj.modified = now + obj.modification_date = now @configure.subscriber(for_=IObjectEvent) diff --git a/guillotina/tests/test_api.py b/guillotina/tests/test_api.py index 5e6d8f0a4..6d293b867 100644 --- a/guillotina/tests/test_api.py +++ b/guillotina/tests/test_api.py @@ -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 } }) ) @@ -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): diff --git a/guillotina/tests/test_catalog.py b/guillotina/tests/test_catalog.py index 77fabf1d3..086cdc36e 100644 --- a/guillotina/tests/test_catalog.py +++ b/guillotina/tests/test_catalog.py @@ -12,7 +12,7 @@ def test_indexed_fields(dummy_guillotina, loop): assert 'uuid' in fields assert 'path' in fields assert 'title' in fields - assert 'created' in fields + assert 'creation_date' in fields @pytest.mark.usefixtures("dummy_request") diff --git a/guillotina/tests/test_jsonschema.py b/guillotina/tests/test_jsonschema.py index 08b98a60e..2df62a254 100644 --- a/guillotina/tests/test_jsonschema.py +++ b/guillotina/tests/test_jsonschema.py @@ -5,6 +5,6 @@ def test_convert_dublin_core(): schema = convert_interface_to_schema(IDublinCore) assert 'title' in schema - assert 'created' in schema + assert 'creation_date' in schema assert 'tags' in schema assert schema['tags']['type'] == 'array' diff --git a/guillotina/tests/utils.py b/guillotina/tests/utils.py index 7ad56f19a..4283fc91d 100644 --- a/guillotina/tests/utils.py +++ b/guillotina/tests/utils.py @@ -121,7 +121,10 @@ def run_docker_postgresql(label='testingaiopg'): while count < 30 and not opened: count += 1 - container_obj = docker_client.containers.get(ident) + try: + container_obj = docker_client.containers.get(ident) + except docker.errors.NotFound: + continue print(container_obj.status) sleep(2) if container_obj.attrs['NetworkSettings']['IPAddress'] != '':