Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename modified to modification_date and created to creation_date #47

Merged
merged 1 commit into from
Apr 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions guillotina/json/serialize_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
2 changes: 1 addition & 1 deletion guillotina/subscribers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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
2 changes: 1 addition & 1 deletion guillotina/tests/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion guillotina/tests/test_jsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
5 changes: 4 additions & 1 deletion guillotina/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'] != '':
Expand Down