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
7dc5116b
Commit
7dc5116b
authored
Nov 10, 2000
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merged locale-dependency fix from 2.2 branch
parent
6d63757e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
14 deletions
+26
-14
lib/python/webdav/common.py
lib/python/webdav/common.py
+26
-14
No files found.
lib/python/webdav/common.py
View file @
7dc5116b
...
...
@@ -85,10 +85,10 @@
"""Commonly used functions for WebDAV support modules."""
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
import
string
,
time
,
urllib
from
Acquisition
import
aq_base
def
absattr
(
attr
):
...
...
@@ -96,11 +96,6 @@ def absattr(attr):
return
attr
()
return
attr
def
aq_base
(
ob
):
if
hasattr
(
ob
,
'aq_base'
):
return
ob
.
aq_base
return
ob
def
urlfix
(
url
,
s
):
n
=
len
(
s
)
if
url
[
-
n
:]
==
s
:
url
=
url
[:
-
n
]
...
...
@@ -120,26 +115,43 @@ def is_acquired(ob):
return
0
return
1
# These are needed because the various date formats below must
# be in english per the RFCs. That means we can't use strftime,
# which is affected by different locale settings.
weekday_abbr
=
[
'Mon'
,
'Tue'
,
'Wed'
,
'Thu'
,
'Fri'
,
'Sat'
,
'Sun'
]
weekday_full
=
[
'Monday'
,
'Tuesday'
,
'Wednesday'
,
'Thursday'
,
'Friday'
,
'Saturday'
,
'Sunday'
]
monthname
=
[
None
,
'Jan'
,
'Feb'
,
'Mar'
,
'Apr'
,
'May'
,
'Jun'
,
'Jul'
,
'Aug'
,
'Sep'
,
'Oct'
,
'Nov'
,
'Dec'
]
def
iso8601_date
(
ts
=
None
,
format
=
'%Y-%m-%dT%H:%M:%SZ'
):
# Return an ISO 8601 formatted date string, required
# for certain DAV properties.
#1997-12-01T17:42:21-08:00
#Monday, 12-Jan-98 09:25:56 GMT
# '2000-11-10T16:21:09-08:00
if
ts
is
None
:
ts
=
time
.
time
()
return
time
.
strftime
(
format
,
time
.
gmtime
(
ts
))
def
rfc850_date
(
ts
=
None
,
format
=
'%A, %d-%b-%y %H:%M:%S GMT'
):
# Return an HTTP-date formatted date string.
if
ts
is
None
:
ts
=
time
.
time
()
return
time
.
strftime
(
format
,
time
.
gmtime
(
ts
))
# 'Friday, 10-Nov-00 16:21:09 GMT'
year
,
month
,
day
,
hh
,
mm
,
ss
,
wd
,
y
,
z
=
time
.
gmtime
(
ts
)
return
"%s, %02d-%3s-%2s %02d:%02d:%02d GMT"
%
(
weekday_full
[
wd
],
day
,
monthname
[
month
],
str
(
year
)[
2
:],
hh
,
mm
,
ss
)
def
rfc1123_date
(
ts
=
None
,
format
=
'%a, %d %b %Y %H:%M:%S GMT'
):
# Return an RFC 1123 format date string, required for
# use in HTTP Date headers per the HTTP 1.1 spec.
if
ts
is
None
:
ts
=
time
.
time
()
return
time
.
strftime
(
format
,
time
.
gmtime
(
ts
))
# 'Fri, 10 Nov 2000 16:21:09 GMT'
year
,
month
,
day
,
hh
,
mm
,
ss
,
wd
,
y
,
z
=
time
.
gmtime
(
ts
)
return
"%s, %02d-%3s-%4d %02d:%02d:%02d GMT"
%
(
weekday_abbr
[
wd
],
day
,
monthname
[
month
],
year
,
hh
,
mm
,
ss
)
def
urlbase
(
url
,
ftype
=
urllib
.
splittype
,
fhost
=
urllib
.
splithost
):
# Return a '/' based url such as '/foo/bar', removing
...
...
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