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
Paul Graydon
erp5
Commits
f0899767
Commit
f0899767
authored
3 years ago
by
Aurel
Committed by
Jérome Perrin
2 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some DateTime variable are moved to module constant
parent
c3858e2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
11 deletions
+22
-11
product/ERP5Type/patches/DateTimePatch.py
product/ERP5Type/patches/DateTimePatch.py
+22
-11
No files found.
product/ERP5Type/patches/DateTimePatch.py
View file @
f0899767
...
@@ -89,16 +89,28 @@ DateTimeKlass.__getstate__ = DateTime__getstate__
...
@@ -89,16 +89,28 @@ DateTimeKlass.__getstate__ = DateTime__getstate__
def
DateTime_parse
(
self
,
st
,
datefmt
=
getDefaultDateFormat
()):
def
DateTime_parse
(
self
,
st
,
datefmt
=
getDefaultDateFormat
()):
# Parse date-time components from a string
# Parse date-time components from a string
month
=
year
=
tz
=
tm
=
None
month
=
year
=
tz
=
tm
=
None
spaces
=
self
.
space_chars
try
:
# BBB DateTime 2.12
intpat
=
self
.
int_pattern
spaces
=
self
.
space_chars
fltpat
=
self
.
flt_pattern
intpat
=
self
.
int_pattern
wordpat
=
self
.
name_pattern
fltpat
=
self
.
flt_pattern
delimiters
=
self
.
delimiters
wordpat
=
self
.
name_pattern
MonthNumbers
=
self
.
_monthmap
delimiters
=
self
.
delimiters
DayOfWeekNames
=
self
.
_daymap
MonthNumbers
=
self
.
_monthmap
ValidZones
=
self
.
_tzinfo
.
_zidx
DayOfWeekNames
=
self
.
_daymap
ValidZones
=
self
.
_tzinfo
.
_zidx
_MONTH_LEN
=
self
.
_month_len
except
AttributeError
:
from
DateTime.DateTime
import
(
SPACE_CHARS
as
spaces
,
INT_PATTERN
as
intpat
,
FLT_PATTERN
as
fltpat
,
NAME_PATTERN
as
wordpat
,
DELIMITERS
as
delimiters
,
_MONTHMAP
as
MonthNumbers
,
_DAYMAP
as
DayOfWeekNames
,
_TZINFO
,
_MONTH_LEN
)
ValidZones
=
_TZINFO
.
_zidx
TimeModifiers
=
[
'am'
,
'pm'
]
TimeModifiers
=
[
'am'
,
'pm'
]
# Find timezone first, since it should always be the last
# Find timezone first, since it should always be the last
# element, and may contain a slash, confusing the parser.
# element, and may contain a slash, confusing the parser.
st
=
st
.
strip
()
st
=
st
.
strip
()
...
@@ -236,10 +248,9 @@ def DateTime_parse(self, st, datefmt=getDefaultDateFormat()):
...
@@ -236,10 +248,9 @@ def DateTime_parse(self, st, datefmt=getDefaultDateFormat()):
year
=
_correctYear
(
year
)
year
=
_correctYear
(
year
)
#handle dates before year 1000
#handle dates before year 1000
#if year < 1000: raise SyntaxError, st
#if year < 1000: raise SyntaxError, st
leap
=
year
%
4
==
0
and
(
year
%
100
!=
0
or
year
%
400
==
0
)
leap
=
year
%
4
==
0
and
(
year
%
100
!=
0
or
year
%
400
==
0
)
try
:
try
:
if
not
day
or
day
>
self
.
_month_len
[
leap
][
month
]:
if
not
day
or
day
>
_MONTH_LEN
[
leap
][
month
]:
raise
DateError
(
st
)
raise
DateError
(
st
)
except
IndexError
:
except
IndexError
:
raise
DateError
(
st
)
raise
DateError
(
st
)
...
...
This diff is collapsed.
Click to expand it.
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