Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
e5d093be
Commit
e5d093be
authored
Jun 19, 2001
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
b7259de4
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
538 additions
and
9 deletions
+538
-9
lib/python/AccessControl/DTML.py
lib/python/AccessControl/DTML.py
+4
-2
lib/python/DateTime/__init__.py
lib/python/DateTime/__init__.py
+1
-0
lib/python/DateTime/newDateTime.py
lib/python/DateTime/newDateTime.py
+169
-0
lib/python/DateTime/newDateTimeZone.py
lib/python/DateTime/newDateTimeZone.py
+355
-0
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+6
-4
lib/python/RestrictedPython/Utilities.py
lib/python/RestrictedPython/Utilities.py
+3
-3
No files found.
lib/python/AccessControl/DTML.py
View file @
e5d093be
...
@@ -84,12 +84,13 @@
...
@@ -84,12 +84,13 @@
##############################################################################
##############################################################################
'''Add security system support to Document Templates
'''Add security system support to Document Templates
$Id: DTML.py,v 1.
4 2001/05/23 14:42:04
andreas Exp $'''
$Id: DTML.py,v 1.
5 2001/06/19 15:33:09
andreas Exp $'''
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
from
DocumentTemplate
import
DT_Util
from
DocumentTemplate
import
DT_Util
import
SecurityManagement
,
string
,
math
,
whrandom
,
random
import
SecurityManagement
,
string
,
math
,
whrandom
,
random
import
DocumentTemplate.sequence
import
DocumentTemplate.sequence
import
DateTime.newDateTime
# Allow access to unprotected attributes
# Allow access to unprotected attributes
DT_Util
.
TemplateDict
.
__allow_access_to_unprotected_subobjects__
=
1
DT_Util
.
TemplateDict
.
__allow_access_to_unprotected_subobjects__
=
1
...
@@ -99,6 +100,7 @@ whrandom.__allow_access_to_unprotected_subobjects__=1
...
@@ -99,6 +100,7 @@ whrandom.__allow_access_to_unprotected_subobjects__=1
random
.
__allow_access_to_unprotected_subobjects__
=
1
random
.
__allow_access_to_unprotected_subobjects__
=
1
DocumentTemplate
.
sequence
.
__allow_access_to_unprotected_subobjects__
=
1
DocumentTemplate
.
sequence
.
__allow_access_to_unprotected_subobjects__
=
1
DateTime
.
newDateTime
.
__allow_access_to_unprotected_subobjects__
=
1
# Add security testing capabilities
# Add security testing capabilities
...
...
lib/python/DateTime/__init__.py
View file @
e5d093be
...
@@ -84,3 +84,4 @@
...
@@ -84,3 +84,4 @@
##############################################################################
##############################################################################
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
DateTime
import
Timezones
from
DateTime
import
Timezones
from
newDateTime
import
DateTime
as
newDateTime
lib/python/DateTime/newDateTime.py
0 → 100644
View file @
e5d093be
from
mx.DateTime
import
DateTime
as
mxDateTime
from
mx.DateTime
import
DateTimeFrom
as
mxDateTimeFrom
from
mx.DateTime
import
Time
as
mxTime
from
mx.DateTime
import
DateFromTicks
as
mxDateFromTicks
from
mx.DateTime
import
TimestampFromTicks
as
mxTimestampFromTicks
from
mx.DateTime
import
ARPA
from
mx.DateTime
import
now
from
mx.DateTime
import
strptime
from
mx.DateTime.Timezone
import
zonetable
from
newDateTimeZone
import
_TimeZoneMapper
import
time
,
types
from
time
import
localtime
class
DateTime
:
__roles__
=
None
__allow_access_to_unprotected_subobjects__
=
1
def
__init__
(
self
,
*
args
):
if
len
(
args
)
==
0
or
(
len
(
args
)
>
0
and
args
[
0
]
==
None
):
self
.
dt
=
mxTimestampFromTicks
(
time
.
time
())
elif
(
type
(
args
[
0
])
is
types
.
FloatType
or
type
(
args
[
0
])
is
types
.
IntType
and
len
(
args
)
==
1
):
self
.
dt
=
mxTimestampFromTicks
(
args
[
0
])
elif
type
(
args
[
0
])
is
types
.
StringType
and
len
(
args
)
==
1
:
self
.
dt
=
mxDateTimeFrom
(
args
[
0
])
elif
(
type
(
args
[
0
])
is
types
.
StringType
and
type
(
args
[
0
])
is
types
.
StringType
and
len
(
args
)
==
2
):
self
.
dt
=
strptime
(
args
[
0
],
args
[
1
])
else
:
self
.
dt
=
apply
(
mxDateTime
,
args
)
for
x
in
dir
(
self
.
dt
):
setattr
(
self
,
x
,
getattr
(
self
.
dt
,
x
))
def
strftime
(
self
,
fmt
):
return
self
.
dt
.
strftime
(
fmt
)
def
ISO
(
self
):
return
self
.
dt
.
strftime
(
'%04Y-%02m-%02d %02H:%02M:%02S'
)
def
HTML4
(
self
):
return
self
.
dt
.
strftime
(
'%04Y-%02m-%02dT%02H:%02M:%02S%Z'
)
def
rfc822
(
self
):
return
ARPA
.
strGMT
(
self
.
dt
)
def
dow
(
self
):
return
self
.
dt
.
day_of_week
def
dayOfYear
(
self
):
return
self
.
dt
.
day_of_year
def
yy
(
self
):
return
self
.
strftime
(
'%02y'
)
def
mm
(
self
):
return
self
.
strftime
(
'%02m'
)
def
dd
(
self
):
return
self
.
strftime
(
'%02d'
)
def
h_24
(
self
):
return
self
.
strftime
(
'%02H'
)
def
h_12
(
self
):
return
self
.
strftime
(
'%02I'
)
def
ampm
(
self
):
return
self
.
strftime
(
'%P'
)
def
hour
(
self
):
return
self
.
dt
.
hour
def
minute
(
self
):
return
self
.
dt
.
minute
def
second
(
self
):
return
int
(
self
.
dt
.
second
)
def
millis
(
self
):
return
self
.
dt
.
second
-
int
(
self
.
dt
.
second
)
def
day
(
self
):
return
self
.
dt
.
day
def
month
(
self
):
return
self
.
dt
.
month
def
year
(
self
):
return
self
.
dt
.
year
def
timezone
(
self
):
return
self
.
dt
.
timezone
def
Day
(
self
):
return
self
.
strftime
(
'%A'
)
def
DayOfWeek
(
self
):
return
self
.
Day
()
def
aDay
(
self
):
return
self
.
strftime
(
'%a'
)
def
pDay
(
self
):
return
self
.
strftime
(
'%a.'
)
def
Day_
(
self
):
return
self
.
pDay
()
def
dow
(
self
):
return
self
.
strftime
(
'%w'
)
def
dow_1
(
self
):
return
self
.
dow
()
+
1
def
Month
(
self
):
return
self
.
strftime
(
'%B'
)
def
aMonth
(
self
):
return
self
.
strftime
(
'%b'
)
def
Mon
(
self
):
return
self
.
aMonth
()
def
pMonth
(
self
):
return
self
.
strftime
(
'%b.'
)
def
Mon_
(
self
):
return
self
.
pMonth
()
def
isLeapYear
(
self
):
return
self
.
dt
.
is_leapyear
def
timeTime
(
self
):
return
self
.
dt
.
gmticks
()
def
toZone
(
self
,
z
):
return
self
.
dt
+
mxTime
(
zonetable
[
z
])
def
isFuture
(
self
):
return
self
.
dt
>
now
()
def
isPast
(
self
):
return
self
.
dt
<
now
()
def
isCurrentYear
(
self
):
return
self
.
dt
.
year
==
now
().
year
def
isCurrentMonth
(
self
):
return
self
.
isCurrentYear
()
and
self
.
dt
.
month
==
now
().
month
def
isCurrentDay
(
self
):
return
self
.
date
()
and
now
().
date
()
def
isCurrentHour
(
self
):
return
self
.
isCurrentDay
()
and
self
.
dt
.
hour
==
now
.
hour
def
isCurrentMinute
(
self
):
return
self
.
isCurrentHour
()
and
self
.
dt
.
minute
==
now
.
minute
def
earliestTime
(
self
):
return
mxDateTime
(
self
.
dt
.
year
,
self
.
dt
.
month
,
self
.
dt
.
day
)
def
latestTime
(
self
):
return
mxDateTime
(
self
.
dt
.
year
,
self
.
dt
.
month
,
self
.
dt
.
day
,
23
,
59
,
59
)
def
greaterThan
(
self
,
t
):
return
self
.
dt
>
t
.
dt
def
greaterThanEqualTo
(
self
,
t
):
return
self
.
dt
>=
t
.
dt
def
equalTo
(
self
,
t
):
return
self
.
dt
==
t
.
dt
def
notEqualTo
(
self
,
t
):
return
self
.
dt
!=
t
.
dt
def
lessThan
(
self
,
t
):
return
self
.
dt
<
t
.
dt
def
lessThanEqualTo
(
self
,
t
):
return
self
.
dt
<=
t
.
dt
def
parts
(
self
):
return
self
.
dt
.
year
,
self
.
dt
.
month
,
self
.
dt
.
day
,
self
.
dt
.
hour
,
\
self
.
dt
.
minute
,
self
.
dt
.
second
,
self
.
dt
.
timezone
def
localZone
(
self
,
ltm
=
None
):
pass
def
Date
(
self
):
return
self
.
strftime
(
'%Y/%m/%d'
)
def
Time
(
self
):
return
self
.
strftime
(
'%H:%M:%S'
)
def
TimeMinutes
(
self
):
return
self
.
strftime
(
'%H:%M'
)
def
AMPM
(
self
):
return
self
.
strftime
(
'%I:%M:%S %P'
)
def
AMPMMinutes
(
self
):
return
self
.
strftime
(
'%I:%M %P'
)
def
PreciseTime
(
self
):
return
self
.
strftime
(
'%H:%M:'
)
+
'%06.3f'
%
(
self
.
dt
.
second
)
def
PreciseAMPM
(
self
):
return
self
.
strftime
(
'%I:%M:'
)
+
'%06.3f'
%
(
self
.
dt
.
second
)
+
self
.
strftime
(
' %P'
)
def
fCommon
(
self
):
return
self
.
strftime
(
'%B %d, %Y %l:%M %P'
)
def
fCommonZ
(
self
):
return
self
.
strftime
(
'%B %d, %Y %l:%M %P '
)
+
self
.
dt
.
timezone
def
aCommon
(
self
):
return
self
.
strftime
(
'%b %d, %Y %l:%M %P'
)
def
aCommonZ
(
self
):
return
self
.
strftime
(
'%b %d, %Y %l:%M %P '
)
+
self
.
dt
.
timezone
def
pCommon
(
self
):
return
self
.
strftime
(
'%b. %d, %Y %l:%M %P'
)
def
pCommonZ
(
self
):
return
self
.
strftime
(
'%b. %d, %Y %l:%M %P '
)
+
self
.
dt
.
timezone
def
__add__
(
self
,
other
):
return
self
.
dt
+
other
__radd__
=
__add__
def
__sub__
(
self
,
other
):
return
self
.
dt
-
other
def
__int__
(
self
):
return
int
(
self
.
dt
.
second
)
def
__long__
(
self
):
return
long
(
self
.
dt
.
second
)
def
__float__
(
self
):
return
self
.
dt
.
second
def
__cmp__
(
self
,
dateTime
):
try
:
return
cmp
(
self
.
dt
,
dateTime
.
dt
)
except
AttributeError
:
return
cmp
(
self
.
dt
.
ticks
(),
dateTime
)
def
__hash__
(
self
):
return
int
(((
self
.
dt
.
year
%
100
*
12
+
self
.
_month
)
*
31
+
self
.
dt
.
day
+
self
.
hour
)
*
100
)
def
__str__
(
self
):
return
str
(
self
.
dt
)
def
__repr__
(
self
):
return
self
.
dt
def
__getattr__
(
self
,
fmt
):
if
'%'
in
fmt
:
return
strftimeFormater
(
self
.
dt
,
fmt
)
raise
AttributeError
,
fmt
def
Timezones
():
"""Return the list of recognized timezone names"""
return
_TimeZoneMapper
.
_zoneList
class
strftimeFormater
:
def
__init__
(
self
,
dt
,
fmt
):
self
.
dt
=
dt
self
.
fmt
=
fmt
def
__call__
(
self
,
*
args
):
return
self
.
dt
.
strftime
(
self
.
fmt
)
lib/python/DateTime/newDateTimeZone.py
0 → 100644
View file @
e5d093be
This diff is collapsed.
Click to expand it.
lib/python/OFS/Application.py
View file @
e5d093be
...
@@ -84,13 +84,14 @@
...
@@ -84,13 +84,14 @@
##############################################################################
##############################################################################
__doc__
=
'''Application support
__doc__
=
'''Application support
$Id: Application.py,v 1.15
2 2001/06/18 21:02:38 chrism
Exp $'''
$Id: Application.py,v 1.15
3 2001/06/19 15:33:10 andreas
Exp $'''
__version__
=
'$Revision: 1.15
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.15
3
$'
[
11
:
-
2
]
import
Globals
,
Folder
,
os
,
sys
,
App
.
Product
,
App
.
ProductRegistry
,
misc_
import
Globals
,
Folder
,
os
,
sys
,
App
.
Product
,
App
.
ProductRegistry
,
misc_
import
time
,
traceback
,
os
,
string
,
Products
import
time
,
traceback
,
os
,
string
,
Products
from
string
import
strip
,
lower
,
find
,
rfind
,
join
from
string
import
strip
,
lower
,
find
,
rfind
,
join
from
DateTime
import
DateTime
import
DateTime
from
AccessControl.User
import
UserFolder
from
AccessControl.User
import
UserFolder
from
App.ApplicationManager
import
ApplicationManager
from
App.ApplicationManager
import
ApplicationManager
from
webdav.NullResource
import
NullResource
from
webdav.NullResource
import
NullResource
...
@@ -247,7 +248,8 @@ class Application(Globals.ApplicationDefaultPermissions,
...
@@ -247,7 +248,8 @@ class Application(Globals.ApplicationDefaultPermissions,
def
PrincipiaTime
(
self
,
*
args
):
def
PrincipiaTime
(
self
,
*
args
):
"""Utility function to return current date/time"""
"""Utility function to return current date/time"""
return
apply
(
DateTime
,
args
)
if
len
(
args
)
==
0
:
return
DateTime
.
newDateTime
()
else
:
return
apply
(
DateTime
.
newDateTime
,
args
)
ZopeTime
=
PrincipiaTime
ZopeTime
=
PrincipiaTime
ZopeAttributionButton__roles__
=
None
ZopeAttributionButton__roles__
=
None
...
...
lib/python/RestrictedPython/Utilities.py
View file @
e5d093be
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
#
#
##############################################################################
##############################################################################
__version__
=
'$Revision: 1.
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
import
string
,
math
,
random
,
whrandom
import
string
,
math
,
random
,
whrandom
import
DocumentTemplate.sequence
import
DocumentTemplate.sequence
...
@@ -97,8 +97,8 @@ utility_builtins['whrandom'] = whrandom
...
@@ -97,8 +97,8 @@ utility_builtins['whrandom'] = whrandom
utility_builtins
[
'sequence'
]
=
DocumentTemplate
.
sequence
utility_builtins
[
'sequence'
]
=
DocumentTemplate
.
sequence
try
:
try
:
import
DateTime
import
DateTime
.newDateTime
utility_builtins
[
'DateTime'
]
=
DateTime
.
DateTime
utility_builtins
[
'DateTime'
]
=
DateTime
.
new
DateTime
except
:
pass
except
:
pass
def
same_type
(
arg1
,
*
args
):
def
same_type
(
arg1
,
*
args
):
...
...
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