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
Labels
Merge Requests
140
Merge Requests
140
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
bc567885
Commit
bc567885
authored
Jan 18, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DateTimePatch: document __setstate__ patch and make it support DateTime 4
parent
314c2db9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
product/ERP5Type/patches/DateTimePatch.py
product/ERP5Type/patches/DateTimePatch.py
+11
-1
No files found.
product/ERP5Type/patches/DateTimePatch.py
View file @
bc567885
...
@@ -35,10 +35,20 @@ SyntaxError, DateError, TimeError, localtime, time
...
@@ -35,10 +35,20 @@ SyntaxError, DateError, TimeError, localtime, time
STATE_KEY
=
'str'
STATE_KEY
=
'str'
# ERP5 Patch for different pickle implementation, to optimize for disk usage.
# We had different __getstate__ implementations, so we need __setstate__ to support
# loading these formats that might be present in ZODBs.
# This patch does not have support for timezone naive flag, because we don't need it
# so far and also probably because we did not notice that it was added in original
# DateTime.
original_DateTime__setstate__
=
DateTimeKlass
.
__setstate__
original_DateTime__setstate__
=
DateTimeKlass
.
__setstate__
def
DateTime__setstate__
(
self
,
state
):
def
DateTime__setstate__
(
self
,
state
):
self
.
__dict__
.
clear
()
try
:
# BBB DateTime 2.12.8
self
.
__dict__
.
clear
()
except
AttributeError
:
pass
self
.
_timezone_naive
=
False
if
isinstance
(
state
,
tuple
):
if
isinstance
(
state
,
tuple
):
t
,
tz
=
state
t
,
tz
=
state
ms
=
(
t
-
math
.
floor
(
t
))
ms
=
(
t
-
math
.
floor
(
t
))
...
...
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