Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
erp5
Commits
ae914b02
Commit
ae914b02
authored
May 06, 2016
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_hal_json_style: serialize datetime value for basic datetime instance
parent
b8527db0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
165 additions
and
1 deletion
+165
-1
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+7
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_zuite/datetimefield_zuite/testBasicDateTimeType.xml
...js_ui_zuite/datetimefield_zuite/testBasicDateTimeType.xml
+58
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_zuite/datetimefield_zuite/testBasicDateTimeType.zpt
...js_ui_zuite/datetimefield_zuite/testBasicDateTimeType.zpt
+97
-0
bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSCore.py
...Item/portal_components/test.erp5.testFunctionalRJSCore.py
+1
-0
bt5/erp5_web_renderjs_ui_test/bt/dependency_list
bt5/erp5_web_renderjs_ui_test/bt/dependency_list
+2
-1
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
ae914b02
...
...
@@ -3,6 +3,9 @@ import json
from
base64
import
urlsafe_b64encode
,
urlsafe_b64decode
from
DateTime
import
DateTime
from
ZODB.POSException
import
ConflictError
import
datetime
import
time
from
email.Utils
import
formatdate
if
REQUEST
is
None
:
REQUEST
=
context
.
REQUEST
...
...
@@ -193,6 +196,8 @@ def renderField(traversed_document, field, form_relative_url, value=None, meta_t
if
same_type
(
date_value
,
DateTime
()):
# Serialize DateTime
date_value
=
date_value
.
rfc822
()
elif
isinstance
(
date_value
,
datetime
.
date
):
date_value
=
formatdate
(
time
.
mktime
(
date_value
.
timetuple
()))
result
[
"default"
]
=
date_value
for
subkey
in
(
"year"
,
"month"
,
"day"
,
"hour"
,
"minute"
,
"ampm"
,
"timezone"
):
result
[
"subfield_%s_key"
%
subkey
]
=
traversed_document
.
Field_getSubFieldKeyDict
(
field
,
subkey
,
key
=
result
[
"key"
])
...
...
@@ -1082,6 +1087,8 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
if
same_type
(
property_value
,
DateTime
()):
# Serialize DateTime
property_value
=
property_value
.
rfc822
()
elif
isinstance
(
property_value
,
datetime
.
date
):
property_value
=
formatdate
(
time
.
mktime
(
property_value
.
timetuple
()))
elif
getattr
(
property_value
,
'translate'
,
None
)
is
not
None
:
property_value
=
"%s"
%
property_value
document_result
[
select
]
=
property_value
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_zuite/datetimefield_zuite/testBasicDateTimeType.xml
0 → 100644
View file @
ae914b02
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
testBasicDateTimeType
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_zuite/datetimefield_zuite/testBasicDateTimeType.zpt
0 → 100644
View file @
ae914b02
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:metal=
"http://xml.zope.org/namespaces/metal"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>
Test RenderJS UI
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test RenderJS UI
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/init"
/>
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/renderjs_runner/#/test_suite_module/
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//a[@data-i18n='Add']
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
link=Add
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//select[@name="field_your_portal_type"]
</td>
<td></td>
</tr>
<tr>
<td>
select
</td>
<td>
//select[@name="field_your_portal_type"]
</td>
<td>
label=Test Suite
</td>
</tr>
<tr>
<td>
click
</td>
<td>
//button[@data-i18n='Proceed']
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//button[@data-i18n='Proceed']
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//button[@data-i18n="Save"]
</td>
<td></td>
</tr>
<tr>
<td>
storeLocation
</td>
<td>
url
</td>
<td></td>
</tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/wait_for_activities"
/>
<tr>
<td>
open
</td>
<td>
${url}
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//button[@data-i18n="Save"]
</td>
<td></td>
</tr>
<tr>
<td>
verifyElementPresent
</td>
<td>
//input[@name="field_last_check"]
</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testFunctionalRJSCore.py
View file @
ae914b02
...
...
@@ -40,6 +40,7 @@ class TestRenderJSUICore(ERP5TypeFunctionalTestCase):
'erp5_web_renderjs_ui_test'
,
'erp5_ui_test_core'
,
'erp5_accounting'
,
'erp5_test_result'
,
)
def
test_suite
():
...
...
bt5/erp5_web_renderjs_ui_test/bt/dependency_list
View file @
ae914b02
erp5_ui_test_core
erp5_ui_test
erp5_web_renderjs_ui
erp5_accounting
\ No newline at end of file
erp5_accounting
erp5_test_result
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment