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
15407cce
Commit
15407cce
authored
Jan 30, 2003
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We can simplify the definition of realpath() since we require Python
2.2 now.
parent
bbd49949
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
30 deletions
+4
-30
lib/python/App/Common.py
lib/python/App/Common.py
+4
-30
No files found.
lib/python/App/Common.py
View file @
15407cce
...
...
@@ -13,10 +13,13 @@
"""Commonly used utility functions."""
__version__
=
'$Revision: 1.1
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
8
$'
[
11
:
-
2
]
import
sys
,
os
,
time
# Legacy API for this module; 3rd party code may use this.
from
os.path
import
realpath
# These are needed because the various date formats below must
# be in english per the RFCs. That means we can't use strftime,
...
...
@@ -128,32 +131,3 @@ def attrget(o,name,default):
return
default
def
Dictionary
(
**
kw
):
return
kw
# Sorry Guido
try
:
# Python 2.2. already has a realpath function, while 2.1 doesn't
realpath
=
os
.
path
.
realpath
except
:
if
os
.
name
==
'posix'
:
def
realpath
(
filename
):
"""
Return the canonical path of the specified filename,
eliminating any symbolic links encountered in the path
(this is ripped off from Python 2.2).
"""
filename
=
os
.
path
.
abspath
(
filename
)
bits
=
[
'/'
]
+
filename
.
split
(
'/'
)[
1
:]
for
i
in
range
(
2
,
len
(
bits
)
+
1
):
component
=
os
.
path
.
join
(
*
bits
[
0
:
i
])
if
os
.
path
.
islink
(
component
):
resolved
=
os
.
readlink
(
component
)
(
dir
,
file
)
=
os
.
path
.
split
(
component
)
resolved
=
os
.
path
.
normpath
(
os
.
path
.
join
(
dir
,
resolved
))
newpath
=
os
.
path
.
join
(
*
([
resolved
]
+
bits
[
i
:]))
return
realpath
(
newpath
)
return
filename
else
:
# other platforms are assumed to not have symlinks, so we alias
# realpath to abspath
realpath
=
os
.
path
.
abspath
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