Skip to content

Commit

Permalink
Adjust date format return by plone.restapi,
Browse files Browse the repository at this point in the history
in docs and tests.

With the latest plone.restapi version all datetimes are now converted
to UTC datetimes (see plone/plone.restapi#493
for more information)
  • Loading branch information
phgross committed Aug 9, 2018
1 parent 7e7738d commit ccbaa10
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 25 deletions.
7 changes: 6 additions & 1 deletion docs/public/dev-manual/api/docs_changelog.rst
Expand Up @@ -5,6 +5,11 @@ Changelog

Im Folgenden sind (substantielle) Änderungen an der Dokumentation aufgeführt.

2018-08-09
----------

- REST API: datetime-Felder werden neu in UTC :doc:`serialisiert <serialization>` statt Lokalzeit.

2018-07-17
----------

Expand Down Expand Up @@ -67,4 +72,4 @@ Im Folgenden sind (substantielle) Änderungen an der Dokumentation aufgeführt.
- Kapitel "Inhaltstypen" hinzugefügt
- Initiale Version erstellt

.. disqus::
.. disqus::
6 changes: 3 additions & 3 deletions docs/public/dev-manual/api/examples/workflow_get.json
Expand Up @@ -8,14 +8,14 @@ Content-Type: application/json
"actor": "john.doe",
"comments": "",
"review_state": "dossier-state-active",
"time": "2016-08-02T15:08:50+02:00"
"time": "2016-08-02T17:08:50+00:00"
},
{
"action": "dossier-transition-resolve",
"actor": "john.doe",
"comments": "",
"review_state": "dossier-state-resolved",
"time": "2016-08-02T15:08:54+02:00"
"time": "2016-08-02T17:08:54+00:00"
}
],
"transitions": [
Expand All @@ -24,4 +24,4 @@ Content-Type: application/json
"title": "dossier-transition-reactivate"
}
]
}
}
4 changes: 2 additions & 2 deletions docs/public/dev-manual/api/examples/workflow_post.json
Expand Up @@ -6,5 +6,5 @@ Content-Type: application/json
"actor": "john.doe",
"comments": "",
"review_state": "dossier-state-active",
"time": "2016-08-02T15:18:21+02:00"
}
"time": "2016-08-02T15:20:21+00:00"
}
6 changes: 3 additions & 3 deletions docs/public/dev-manual/api/operations.rst
Expand Up @@ -58,7 +58,7 @@ children des Objekts).
"comments": null,
"container_location": null,
"container_type": null,
"created": "2016-01-08T09:51:40+01:00",
"created": "2016-01-08T10:51:40+00:00",
"custody_period": 30,
"date_of_cassation": null,
"date_of_submission": null,
Expand All @@ -81,7 +81,7 @@ children des Objekts).
"title": "Ein weiteres Dokument"
}
],
"modified": "2016-01-19T11:15:22+01:00",
"modified": "2016-01-19T11:15:22+00:00",
"number_of_containers": null,
"parent": {
"@id": "https://example.org/ordnungssystem/fuehrung",
Expand Down Expand Up @@ -205,4 +205,4 @@ Um ein oder mehrere Attribute eines Objekts zu aktualisieren, wird ein

.. literalinclude:: examples/example_patch.py

.. disqus::
.. disqus::
24 changes: 14 additions & 10 deletions docs/public/dev-manual/api/serialization.rst
Expand Up @@ -20,16 +20,20 @@ Datum / Zeit

Da JSON keinen nativen Support für datetimes bietet, werden Python/Zope
datetimes zu `ISO 8601 <https://de.wikipedia.org/wiki/ISO_8601>`_ Strings
serialisiert.
serialisiert. Als Zeitzone wird bei der Serialisierung immer UTC verwendet,
nicht Lokalzeit.

============================================================================== ======================================
Python JSON
============================================================================== ======================================
``time(19, 45, 55)`` ``'19:45:55'``
``date(2015, 11, 23)`` ``'2015-11-23'``
``datetime(2015, 11, 23, 19, 45, 55, tzinfo=pytz.timezone('Europe/Zurich'))`` ``'2015-11-23T18:45:55+00:00'``
``DateTime('2018/08/09 13:43:27.261730 GMT+2')`` ``'2018-08-09T11:43:58+00:00'``
============================================================================== ======================================



======================================= ======================================
Python JSON
======================================= ======================================
``time(19, 45, 55)`` ``'19:45:55'``
``date(2015, 11, 23)`` ``'2015-11-23'``
``datetime(2015, 11, 23, 19, 45, 55)`` ``'2015-11-23T19:45:55'``
``DateTime('2015/11/23 19:45:55')`` ``'2015-11-23T19:45:55'``
======================================= ======================================


Dateien
Expand Down Expand Up @@ -135,4 +139,4 @@ Pfad ``'/dossier/doc1'``
URL ``'http://example.org/dossier/doc1'``
======================================= ======================================

.. disqus::
.. disqus::
11 changes: 5 additions & 6 deletions opengever/api/tests/test_summary.py
Expand Up @@ -97,18 +97,17 @@ def test_summary_with_custom_field_list(self, browser):

summary = browser.json['items'][0]
self.assertEqual(
summary,
{
u'@id': u'http://nohost/plone/ordnungssystem/fuhrung/vertrage-'
u'und-vereinbarungen/dossier-1/document-12',
u'created': u'2016-08-31T15:07:33+02:00',
u'und-vereinbarungen/dossier-1/document-12',
u'created': u'2016-08-31T13:07:33+00:00',
u'creator': u'robert.ziegler',
u'filename': u'Vertraegsentwurf.docx',
u'filesize': 27413,
u'mimetype': u'application/vnd.openxmlformats-officedocument.'
u'wordprocessingml.document',
u'modified': u'2016-08-31T15:07:33+02:00',
})
u'wordprocessingml.document',
u'modified': u'2016-08-31T13:07:33+00:00'},
summary)

@browsing
def test_summary_with_reference_number(self, browser):
Expand Down

0 comments on commit ccbaa10

Please sign in to comment.