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
d0de6597
Commit
d0de6597
authored
Feb 07, 2002
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace string module calls by string methods
parent
4be8d559
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
64 additions
and
75 deletions
+64
-75
lib/python/App/ApplicationManager.py
lib/python/App/ApplicationManager.py
+4
-5
lib/python/App/CacheManager.py
lib/python/App/CacheManager.py
+6
-6
lib/python/App/Common.py
lib/python/App/Common.py
+2
-3
lib/python/App/Extensions.py
lib/python/App/Extensions.py
+4
-5
lib/python/App/FactoryDispatcher.py
lib/python/App/FactoryDispatcher.py
+2
-3
lib/python/App/FindHomes.py
lib/python/App/FindHomes.py
+9
-9
lib/python/App/ImageFile.py
lib/python/App/ImageFile.py
+5
-6
lib/python/App/Management.py
lib/python/App/Management.py
+6
-7
lib/python/App/Product.py
lib/python/App/Product.py
+7
-8
lib/python/App/ProductContext.py
lib/python/App/ProductContext.py
+5
-5
lib/python/App/RefreshFuncs.py
lib/python/App/RefreshFuncs.py
+2
-3
lib/python/App/Undo.py
lib/python/App/Undo.py
+4
-5
lib/python/App/tar.py
lib/python/App/tar.py
+7
-9
lib/python/App/version_txt.py
lib/python/App/version_txt.py
+1
-1
No files found.
lib/python/App/ApplicationManager.py
View file @
d0de6597
...
@@ -11,10 +11,10 @@
...
@@ -11,10 +11,10 @@
#
#
##############################################################################
##############################################################################
__doc__
=
"""System management components"""
__doc__
=
"""System management components"""
__version__
=
'$Revision: 1.7
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.7
8
$'
[
11
:
-
2
]
import
sys
,
os
,
time
,
string
,
Globals
,
Acquisition
,
os
,
Undo
import
sys
,
os
,
time
,
Globals
,
Acquisition
,
os
,
Undo
from
Globals
import
DTMLFile
from
Globals
import
DTMLFile
from
OFS.ObjectManager
import
ObjectManager
from
OFS.ObjectManager
import
ObjectManager
from
OFS.Folder
import
Folder
from
OFS.Folder
import
Folder
...
@@ -25,7 +25,7 @@ from OFS import SimpleItem
...
@@ -25,7 +25,7 @@ from OFS import SimpleItem
from
App.Dialogs
import
MessageDialog
from
App.Dialogs
import
MessageDialog
from
Product
import
ProductFolder
from
Product
import
ProductFolder
from
version_txt
import
version_txt
from
version_txt
import
version_txt
from
StringIO
import
StringIO
from
c
StringIO
import
StringIO
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
import
zLOG
import
zLOG
...
@@ -360,7 +360,6 @@ class ApplicationManager(Folder,CacheManager):
...
@@ -360,7 +360,6 @@ class ApplicationManager(Folder,CacheManager):
path_join
=
os
.
path
.
join
path_join
=
os
.
path
.
join
isdir
=
os
.
path
.
isdir
isdir
=
os
.
path
.
isdir
exists
=
os
.
path
.
exists
exists
=
os
.
path
.
exists
strip
=
string
.
strip
product_dir
=
path_join
(
SOFTWARE_HOME
,
'Products'
)
product_dir
=
path_join
(
SOFTWARE_HOME
,
'Products'
)
product_names
=
os
.
listdir
(
product_dir
)
product_names
=
os
.
listdir
(
product_dir
)
...
@@ -380,7 +379,7 @@ class ApplicationManager(Folder,CacheManager):
...
@@ -380,7 +379,7 @@ class ApplicationManager(Folder,CacheManager):
file
=
open
(
version_txt
,
'r'
)
file
=
open
(
version_txt
,
'r'
)
data
=
file
.
readline
()
data
=
file
.
readline
()
file
.
close
()
file
.
close
()
info
.
append
(
strip
(
data
))
info
.
append
(
data
.
strip
(
))
return
info
return
info
...
...
lib/python/App/CacheManager.py
View file @
d0de6597
...
@@ -13,10 +13,10 @@
...
@@ -13,10 +13,10 @@
__doc__
=
'''Cache management support
__doc__
=
'''Cache management support
$Id: CacheManager.py,v 1.2
2 2001/11/28 15:50:52 matt
Exp $'''
$Id: CacheManager.py,v 1.2
3 2002/02/07 17:37:10 andreasjung
Exp $'''
__version__
=
'$Revision: 1.2
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
3
$'
[
11
:
-
2
]
import
Globals
,
time
,
sys
,
string
import
Globals
,
time
,
sys
class
CacheManager
:
class
CacheManager
:
"""Cache management mix-in
"""Cache management mix-in
...
@@ -190,8 +190,8 @@ class CacheManager:
...
@@ -190,8 +190,8 @@ class CacheManager:
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
# format as text
# format as text
REQUEST
.
RESPONSE
.
setHeader
(
'Content-Type'
,
'text/plain'
)
REQUEST
.
RESPONSE
.
setHeader
(
'Content-Type'
,
'text/plain'
)
return
string
.
join
(
map
(
lambda
(
name
,
count
):
'%6d %s'
%
return
'
\
n
'
.
join
(
map
(
lambda
(
name
,
count
):
'%6d %s'
%
(
count
,
name
),
detail
)
,
'
\
n
'
)
(
count
,
name
),
detail
))
else
:
else
:
# raw
# raw
return
detail
return
detail
...
@@ -229,7 +229,7 @@ class CacheManager:
...
@@ -229,7 +229,7 @@ class CacheManager:
dict
[
'conn_no'
],
`dict['oid']`
,
dict
[
'rc'
],
dict
[
'conn_no'
],
`dict['oid']`
,
dict
[
'rc'
],
state
,
dict
[
'klass'
],
idinfo
))
state
,
dict
[
'klass'
],
idinfo
))
REQUEST
.
RESPONSE
.
setHeader
(
'Content-Type'
,
'text/plain'
)
REQUEST
.
RESPONSE
.
setHeader
(
'Content-Type'
,
'text/plain'
)
return
string
.
join
(
res
,
'
\
n
'
)
return
'
\
n
'
.
join
(
res
)
else
:
else
:
# raw
# raw
return
detail
return
detail
...
...
lib/python/App/Common.py
View file @
d0de6597
...
@@ -13,10 +13,9 @@
...
@@ -13,10 +13,9 @@
"""Commonly used utility functions."""
"""Commonly used utility functions."""
__version__
=
'$Revision: 1.1
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
1
$'
[
11
:
-
2
]
import
sys
,
os
,
time
import
sys
,
os
,
time
from
string
import
rfind
# These are needed because the various date formats below must
# These are needed because the various date formats below must
...
@@ -98,7 +97,7 @@ def package_home(globals_dict):
...
@@ -98,7 +97,7 @@ def package_home(globals_dict):
if
hasattr
(
m
,
'__path__'
):
if
hasattr
(
m
,
'__path__'
):
r
=
m
.
__path__
[
0
]
r
=
m
.
__path__
[
0
]
elif
"."
in
__name__
:
elif
"."
in
__name__
:
r
=
sys
.
modules
[
__name__
[:
rfind
(
__name__
,
'.'
)]].
__path__
[
0
]
r
=
sys
.
modules
[
__name__
[:
__name__
.
rfind
(
'.'
)]].
__path__
[
0
]
else
:
else
:
r
=
__name__
r
=
__name__
return
os
.
path
.
join
(
os
.
getcwd
(),
r
)
return
os
.
path
.
join
(
os
.
getcwd
(),
r
)
...
...
lib/python/App/Extensions.py
View file @
d0de6597
...
@@ -14,10 +14,9 @@ __doc__='''Standard routines for handling extensions.
...
@@ -14,10 +14,9 @@ __doc__='''Standard routines for handling extensions.
Extensions currently include external methods and pluggable brains.
Extensions currently include external methods and pluggable brains.
$Id: Extensions.py,v 1.1
7 2001/11/28 15:50:52 matt
Exp $'''
$Id: Extensions.py,v 1.1
8 2002/02/07 17:37:10 andreasjung
Exp $'''
__version__
=
'$Revision: 1.1
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
8
$'
[
11
:
-
2
]
from
string
import
find
,
split
import
os
,
zlib
,
rotor
,
imp
import
os
,
zlib
,
rotor
,
imp
import
Products
import
Products
path_split
=
os
.
path
.
split
path_split
=
os
.
path
.
split
...
@@ -79,7 +78,7 @@ def getPath(prefix, name, checkProduct=1, suffixes=('',)):
...
@@ -79,7 +78,7 @@ def getPath(prefix, name, checkProduct=1, suffixes=('',)):
'The file name, %s, should be a simple file name'
%
name
)
'The file name, %s, should be a simple file name'
%
name
)
if
checkProduct
:
if
checkProduct
:
l
=
find
(
name
,
'.'
)
l
=
name
.
find
(
'.'
)
if
l
>
0
:
if
l
>
0
:
p
=
name
[:
l
]
p
=
name
[:
l
]
n
=
name
[
l
+
1
:]
n
=
name
[
l
+
1
:]
...
@@ -128,7 +127,7 @@ def getObject(module, name, reload=0,
...
@@ -128,7 +127,7 @@ def getObject(module, name, reload=0,
m
=
binmod
.
__dict__
m
=
binmod
.
__dict__
elif
p
[
-
4
:]
==
'.pyp'
:
elif
p
[
-
4
:]
==
'.pyp'
:
prod_id
=
split
(
module
,
'.'
)[
0
]
prod_id
=
module
.
split
(
'.'
)[
0
]
data
=
zlib
.
decompress
(
data
=
zlib
.
decompress
(
rotor
.
newrotor
(
prod_id
+
' shshsh'
).
decrypt
(
open
(
p
,
'rb'
).
read
())
rotor
.
newrotor
(
prod_id
+
' shshsh'
).
decrypt
(
open
(
p
,
'rb'
).
read
())
)
)
...
...
lib/python/App/FactoryDispatcher.py
View file @
d0de6597
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
# Implement the manage_addProduct method of object managers
# Implement the manage_addProduct method of object managers
import
Acquisition
,
sys
,
Products
import
Acquisition
,
sys
,
Products
from
string
import
rfind
from
AccessControl.PermissionMapping
import
aqwrap
from
AccessControl.PermissionMapping
import
aqwrap
from
AccessControl.Owned
import
UnownableOwner
from
AccessControl.Owned
import
UnownableOwner
...
@@ -53,8 +52,8 @@ class FactoryDispatcher(Acquisition.Implicit):
...
@@ -53,8 +52,8 @@ class FactoryDispatcher(Acquisition.Implicit):
v
=
REQUEST
[
'URL'
]
v
=
REQUEST
[
'URL'
]
except
KeyError
:
pass
except
KeyError
:
pass
else
:
else
:
v
=
v
[:
rfind
(
v
,
'/'
)]
v
=
v
[:
v
.
rfind
(
'/'
)]
self
.
_u
=
v
[:
rfind
(
v
,
'/'
)]
self
.
_u
=
v
[:
v
.
rfind
(
'/'
)]
def
Destination
(
self
):
def
Destination
(
self
):
"Return the destination for factory output"
"Return the destination for factory output"
...
...
lib/python/App/FindHomes.py
View file @
d0de6597
...
@@ -13,9 +13,9 @@
...
@@ -13,9 +13,9 @@
"""Commonly used utility functions."""
"""Commonly used utility functions."""
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
import
os
,
sys
,
Products
,
string
import
os
,
sys
,
Products
from
Common
import
package_home
from
Common
import
package_home
path_join
=
os
.
path
.
join
path_join
=
os
.
path
.
join
path_split
=
os
.
path
.
split
path_split
=
os
.
path
.
split
...
@@ -63,7 +63,7 @@ ip=path_join(INSTANCE_HOME, 'Products')
...
@@ -63,7 +63,7 @@ ip=path_join(INSTANCE_HOME, 'Products')
ippart
=
0
ippart
=
0
ppath
=
Products
.
__path__
ppath
=
Products
.
__path__
if
os
.
path
.
isdir
(
ip
)
and
ip
not
in
ppath
:
if
os
.
path
.
isdir
(
ip
)
and
ip
not
in
ppath
:
disallow
=
string
.
lower
(
os
.
environ
.
get
(
'DISALLOW_LOCAL_PRODUCTS'
,
''
)
)
disallow
=
os
.
environ
.
get
(
'DISALLOW_LOCAL_PRODUCTS'
,
''
).
lower
(
)
if
disallow
in
(
'no'
,
'off'
,
'0'
,
''
):
if
disallow
in
(
'no'
,
'off'
,
'0'
,
''
):
ppath
.
insert
(
0
,
ip
)
ppath
.
insert
(
0
,
ip
)
ippart
=
1
ippart
=
1
...
@@ -71,14 +71,14 @@ if os.path.isdir(ip) and ip not in ppath:
...
@@ -71,14 +71,14 @@ if os.path.isdir(ip) and ip not in ppath:
ppathpat
=
os
.
environ
.
get
(
'PRODUCTS_PATH'
,
None
)
ppathpat
=
os
.
environ
.
get
(
'PRODUCTS_PATH'
,
None
)
if
ppathpat
is
not
None
:
if
ppathpat
is
not
None
:
psep
=
os
.
pathsep
psep
=
os
.
pathsep
if
string
.
find
(
ppathpat
,
'%('
)
>=
0
:
if
ppathpat
.
find
(
'%('
)
>=
0
:
newppath
=
string
.
split
(
ppathpat
%
{
newppath
=
(
ppathpat
%
{
'PRODUCTS_PATH'
:
string
.
join
(
ppath
,
psep
),
'PRODUCTS_PATH'
:
psep
.
join
(
ppath
),
'SOFTWARE_PRODUCTS'
:
string
.
join
(
ppath
[
ippart
:],
psep
),
'SOFTWARE_PRODUCTS'
:
psep
.
join
(
ppath
[
ippart
:]
),
'INSTANCE_PRODUCTS'
:
ip
,
'INSTANCE_PRODUCTS'
:
ip
,
}
,
psep
)
}
).
split
(
psep
)
else
:
else
:
newppath
=
string
.
split
(
ppathpat
,
psep
)
newppath
=
ppathpat
.
split
(
psep
)
del
ppath
[:]
del
ppath
[:]
for
p
in
filter
(
None
,
newppath
):
for
p
in
filter
(
None
,
newppath
):
p
=
os
.
path
.
abspath
(
p
)
p
=
os
.
path
.
abspath
(
p
)
...
...
lib/python/App/ImageFile.py
View file @
d0de6597
...
@@ -12,17 +12,16 @@
...
@@ -12,17 +12,16 @@
##############################################################################
##############################################################################
"""Image object that is stored in a file"""
"""Image object that is stored in a file"""
__version__
=
'$Revision: 1.1
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
from
OFS.content_types
import
guess_content_type
from
OFS.content_types
import
guess_content_type
from
Globals
import
package_home
from
Globals
import
package_home
from
Common
import
rfc1123_date
from
Common
import
rfc1123_date
from
string
import
rfind
,
split
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
time
import
time
from
time
import
time
from
os
import
stat
from
os
import
stat
import
Acquisition
import
Acquisition
import
string
,
os
import
os
class
ImageFile
(
Acquisition
.
Explicit
):
class
ImageFile
(
Acquisition
.
Explicit
):
...
@@ -42,8 +41,8 @@ class ImageFile(Acquisition.Explicit):
...
@@ -42,8 +41,8 @@ class ImageFile(Acquisition.Explicit):
if
content_type
:
if
content_type
:
self
.
content_type
=
content_type
self
.
content_type
=
content_type
else
:
else
:
self
.
content_type
=
'image/%s'
%
path
[
rfind
(
path
,
'.'
)
+
1
:]
self
.
content_type
=
'image/%s'
%
path
[
path
.
rfind
(
'.'
)
+
1
:]
self
.
__name__
=
path
[
rfind
(
path
,
'/'
)
+
1
:]
self
.
__name__
=
path
[
path
.
rfind
(
'/'
)
+
1
:]
self
.
lmt
=
float
(
stat
(
path
)[
8
])
or
time
()
self
.
lmt
=
float
(
stat
(
path
)[
8
])
or
time
()
self
.
lmh
=
rfc1123_date
(
self
.
lmt
)
self
.
lmh
=
rfc1123_date
(
self
.
lmt
)
...
@@ -55,7 +54,7 @@ class ImageFile(Acquisition.Explicit):
...
@@ -55,7 +54,7 @@ class ImageFile(Acquisition.Explicit):
# somewhere...
# somewhere...
header
=
REQUEST
.
get_header
(
'If-Modified-Since'
,
None
)
header
=
REQUEST
.
get_header
(
'If-Modified-Since'
,
None
)
if
header
is
not
None
:
if
header
is
not
None
:
header
=
string
.
split
(
header
,
';'
)[
0
]
header
=
header
.
split
(
';'
)[
0
]
# Some proxies seem to send invalid date strings for this
# Some proxies seem to send invalid date strings for this
# header. If the date string is not valid, we ignore it
# header. If the date string is not valid, we ignore it
# rather than raise an error to be generally consistent
# rather than raise an error to be generally consistent
...
...
lib/python/App/Management.py
View file @
d0de6597
...
@@ -13,14 +13,13 @@
...
@@ -13,14 +13,13 @@
"""Standard management interface support
"""Standard management interface support
$Id: Management.py,v 1.5
5 2001/11/28 15:50:52 matt
Exp $"""
$Id: Management.py,v 1.5
6 2002/02/07 17:37:10 andreasjung
Exp $"""
__version__
=
'$Revision: 1.5
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
6
$'
[
11
:
-
2
]
import
sys
,
Globals
,
ExtensionClass
,
urllib
import
sys
,
Globals
,
ExtensionClass
,
urllib
from
Dialogs
import
MessageDialog
from
Dialogs
import
MessageDialog
from
Globals
import
DTMLFile
,
HTMLFile
from
Globals
import
DTMLFile
,
HTMLFile
from
string
import
split
,
join
,
find
from
AccessControl
import
getSecurityManager
,
Unauthorized
from
AccessControl
import
getSecurityManager
,
Unauthorized
class
Tabs
(
ExtensionClass
.
Base
):
class
Tabs
(
ExtensionClass
.
Base
):
...
@@ -76,7 +75,7 @@ class Tabs(ExtensionClass.Base):
...
@@ -76,7 +75,7 @@ class Tabs(ExtensionClass.Base):
raise
Unauthorized
,
(
raise
Unauthorized
,
(
'You are not authorized to view this object.'
)
'You are not authorized to view this object.'
)
if
find
(
m
,
'/'
):
if
m
.
find
(
'/'
):
raise
'Redirect'
,
(
raise
'Redirect'
,
(
"%s/%s"
%
(
REQUEST
[
'URL1'
],
m
))
"%s/%s"
%
(
REQUEST
[
'URL1'
],
m
))
...
@@ -100,7 +99,7 @@ class Tabs(ExtensionClass.Base):
...
@@ -100,7 +99,7 @@ class Tabs(ExtensionClass.Base):
script
=
'%s/%s'
%
(
script
,
last
)
script
=
'%s/%s'
%
(
script
,
last
)
out
.
append
(
'<a class="strong-link" href="%s/manage_workspace">%s</a>'
%
out
.
append
(
'<a class="strong-link" href="%s/manage_workspace">%s</a>'
%
(
script
,
unquote
(
last
)))
(
script
,
unquote
(
last
)))
return
'%s%s'
%
(
url
,
join
(
out
,
'/'
))
return
'%s%s'
%
(
url
,
'/'
.
join
(
out
))
def
tabs_path_info
(
self
,
script
,
path
,
def
tabs_path_info
(
self
,
script
,
path
,
# Static vars
# Static vars
...
@@ -111,7 +110,7 @@ class Tabs(ExtensionClass.Base):
...
@@ -111,7 +110,7 @@ class Tabs(ExtensionClass.Base):
while
path
[
-
1
:]
==
'/'
:
path
=
path
[:
-
1
]
while
path
[
-
1
:]
==
'/'
:
path
=
path
[:
-
1
]
while
script
[:
1
]
==
'/'
:
script
=
script
[
1
:]
while
script
[:
1
]
==
'/'
:
script
=
script
[
1
:]
while
script
[
-
1
:]
==
'/'
:
script
=
script
[:
-
1
]
while
script
[
-
1
:]
==
'/'
:
script
=
script
[:
-
1
]
path
=
split
(
path
,
'/'
)[:
-
1
]
path
=
path
.
split
(
'/'
)[:
-
1
]
if
script
:
path
=
[
script
]
+
path
if
script
:
path
=
[
script
]
+
path
if
not
path
:
return
''
if
not
path
:
return
''
script
=
''
script
=
''
...
@@ -121,7 +120,7 @@ class Tabs(ExtensionClass.Base):
...
@@ -121,7 +120,7 @@ class Tabs(ExtensionClass.Base):
script
=
"%s/%s"
%
(
script
,
quote
(
p
))
script
=
"%s/%s"
%
(
script
,
quote
(
p
))
out
.
append
(
'<a href="%s/manage_workspace">%s</a>'
%
(
script
,
p
))
out
.
append
(
'<a href="%s/manage_workspace">%s</a>'
%
(
script
,
p
))
out
.
append
(
last
)
out
.
append
(
last
)
return
join
(
out
,
'/'
)
return
'/'
.
join
(
out
)
class_manage_path__roles__
=
None
class_manage_path__roles__
=
None
def
class_manage_path
(
self
):
def
class_manage_path
(
self
):
...
...
lib/python/App/Product.py
View file @
d0de6597
...
@@ -34,13 +34,12 @@
...
@@ -34,13 +34,12 @@
# on restart if there is still a product directory.
# on restart if there is still a product directory.
import
Globals
,
OFS
.
Folder
,
OFS
.
SimpleItem
,
os
,
string
,
Acquisition
,
Products
import
Globals
,
OFS
.
Folder
,
OFS
.
SimpleItem
,
os
,
Acquisition
,
Products
import
re
,
zlib
,
Globals
,
cPickle
,
marshal
,
rotor
import
re
,
zlib
,
Globals
,
cPickle
,
marshal
,
rotor
import
ZClasses
,
ZClasses
.
ZClass
,
AccessControl
.
Owned
import
ZClasses
,
ZClasses
.
ZClass
,
AccessControl
.
Owned
from
urllib
import
quote
from
urllib
import
quote
from
OFS.Folder
import
Folder
from
OFS.Folder
import
Folder
from
string
import
atoi
,
find
,
strip
,
join
from
Factory
import
Factory
from
Factory
import
Factory
from
Permission
import
PermissionManager
from
Permission
import
PermissionManager
import
ZClasses
,
ZClasses
.
ZClass
import
ZClasses
,
ZClasses
.
ZClass
...
@@ -180,7 +179,7 @@ class Product(Folder, PermissionManager):
...
@@ -180,7 +179,7 @@ class Product(Folder, PermissionManager):
"Set the product up to create a distribution and give a link"
"Set the product up to create a distribution and give a link"
if
self
.
__dict__
.
has_key
(
'manage_options'
):
if
self
.
__dict__
.
has_key
(
'manage_options'
):
raise
TypeError
,
'This product is <b>not</b> redistributable.'
raise
TypeError
,
'This product is <b>not</b> redistributable.'
self
.
version
=
version
=
strip
(
version
)
self
.
version
=
version
=
version
.
strip
(
)
self
.
configurable_objects_
=
configurable_objects
self
.
configurable_objects_
=
configurable_objects
self
.
redistributable
=
redistributable
self
.
redistributable
=
redistributable
RESPONSE
.
redirect
(
'Distributions/%s-%s.tar.gz'
%
RESPONSE
.
redirect
(
'Distributions/%s-%s.tar.gz'
%
...
@@ -256,7 +255,7 @@ class Product(Folder, PermissionManager):
...
@@ -256,7 +255,7 @@ class Product(Folder, PermissionManager):
def
__bobo_traverse__
(
self
,
REQUEST
,
name
):
def
__bobo_traverse__
(
self
,
REQUEST
,
name
):
if
name
[
-
7
:]
!=
'.tar.gz'
:
raise
'Invalid Name'
,
name
if
name
[
-
7
:]
!=
'.tar.gz'
:
raise
'Invalid Name'
,
name
l
=
find
(
name
,
'-'
)
l
=
name
.
find
(
'-'
)
id
,
version
=
name
[:
l
],
name
[
l
+
1
:
-
7
]
id
,
version
=
name
[:
l
],
name
[
l
+
1
:
-
7
]
product
=
self
.
aq_parent
product
=
self
.
aq_parent
if
product
.
id
==
id
and
product
.
version
==
version
:
if
product
.
id
==
id
and
product
.
version
==
version
:
...
@@ -425,7 +424,7 @@ class CompressedOutputFile:
...
@@ -425,7 +424,7 @@ class CompressedOutputFile:
def
getdata
(
self
):
def
getdata
(
self
):
self
.
_r
.
append
(
self
.
_rot
.
encryptmore
(
self
.
_c
.
flush
()))
self
.
_r
.
append
(
self
.
_rot
.
encryptmore
(
self
.
_c
.
flush
()))
return
join
(
self
.
_r
,
''
)
return
''
.
join
(
self
.
_r
)
class
CompressedInputFile
:
class
CompressedInputFile
:
_done
=
0
_done
=
0
...
@@ -459,10 +458,10 @@ class CompressedInputFile:
...
@@ -459,10 +458,10 @@ class CompressedInputFile:
return
r
return
r
def
readline
(
self
):
def
readline
(
self
):
l
=
find
(
self
.
_b
,
'
\
n
'
)
l
=
self
.
_b
.
find
(
'
\
n
'
)
while
l
<
0
and
not
self
.
_done
:
while
l
<
0
and
not
self
.
_done
:
self
.
_next
()
self
.
_next
()
l
=
find
(
self
.
_b
,
'
\
n
'
)
l
=
self
.
_b
.
find
(
'
\
n
'
)
if
l
<
0
:
l
=
len
(
self
.
_b
)
if
l
<
0
:
l
=
len
(
self
.
_b
)
else
:
l
=
l
+
1
else
:
l
=
l
+
1
r
=
self
.
_b
[:
l
]
r
=
self
.
_b
[:
l
]
...
@@ -488,7 +487,7 @@ def initializeProduct(productp, name, home, app):
...
@@ -488,7 +487,7 @@ def initializeProduct(productp, name, home, app):
if
hasattr
(
productp
,
'__import_error__'
):
ie
=
productp
.
__import_error__
if
hasattr
(
productp
,
'__import_error__'
):
ie
=
productp
.
__import_error__
else
:
ie
=
None
else
:
ie
=
None
try
:
fver
=
strip
(
open
(
home
+
'/version.txt'
).
read
()
)
try
:
fver
=
open
(
home
+
'/version.txt'
).
read
().
strip
(
)
except
:
fver
=
''
except
:
fver
=
''
old
=
None
old
=
None
try
:
try
:
...
...
lib/python/App/ProductContext.py
View file @
d0de6597
...
@@ -19,7 +19,7 @@ from HelpSys import HelpTopic, APIHelpTopic
...
@@ -19,7 +19,7 @@ from HelpSys import HelpTopic, APIHelpTopic
from
HelpSys.HelpSys
import
ProductHelp
from
HelpSys.HelpSys
import
ProductHelp
from
FactoryDispatcher
import
FactoryDispatcher
from
FactoryDispatcher
import
FactoryDispatcher
from
zLOG
import
LOG
,
WARNING
from
zLOG
import
LOG
,
WARNING
import
string
,
os
.
path
,
re
import
os.path
,
re
import
stat
import
stat
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
types
import
ListType
,
TupleType
from
types
import
ListType
,
TupleType
...
@@ -210,8 +210,8 @@ class ProductContext:
...
@@ -210,8 +210,8 @@ class ProductContext:
key
=
"%s/%s"
%
(
module
,
name
)
key
=
"%s/%s"
%
(
module
,
name
)
if
module
[:
9
]
==
'Products.'
:
module
=
string
.
split
(
module
,
'.'
)[
1
]
if
module
[:
9
]
==
'Products.'
:
module
=
module
.
split
(
'.'
)[
1
]
else
:
module
=
string
.
split
(
module
,
'.'
)[
0
]
else
:
module
=
module
.
split
(
'.'
)[
0
]
info
=
"%s: %s"
%
(
module
,
name
)
info
=
"%s: %s"
%
(
module
,
name
)
...
@@ -293,7 +293,7 @@ class ProductContext:
...
@@ -293,7 +293,7 @@ class ProductContext:
for
file
in
os
.
listdir
(
path
):
for
file
in
os
.
listdir
(
path
):
ext
=
os
.
path
.
splitext
(
file
)[
1
]
ext
=
os
.
path
.
splitext
(
file
)[
1
]
ext
=
string
.
lower
(
ext
)
ext
=
ext
.
lower
(
)
if
ext
in
(
'.dtml'
,):
if
ext
in
(
'.dtml'
,):
contents
=
open
(
os
.
path
.
join
(
path
,
file
),
'rb'
).
read
()
contents
=
open
(
os
.
path
.
join
(
path
,
file
),
'rb'
).
read
()
m
=
title_re
.
search
(
contents
)
m
=
title_re
.
search
(
contents
)
...
@@ -313,7 +313,7 @@ class ProductContext:
...
@@ -313,7 +313,7 @@ class ProductContext:
ht
=
HelpTopic
.
TextTopic
(
file
,
title
,
os
.
path
.
join
(
path
,
file
))
ht
=
HelpTopic
.
TextTopic
(
file
,
title
,
os
.
path
.
join
(
path
,
file
))
self
.
registerHelpTopic
(
file
,
ht
)
self
.
registerHelpTopic
(
file
,
ht
)
elif
ext
in
(
'.stx'
,
'.txt'
):
elif
ext
in
(
'.stx'
,
'.txt'
):
title
=
string
.
split
(
open
(
os
.
path
.
join
(
path
,
file
),
'rb'
).
readline
(),
':'
)[
0
]
title
=
(
open
(
os
.
path
.
join
(
path
,
file
),
'rb'
).
readline
()).
split
(
':'
)[
0
]
ht
=
HelpTopic
.
STXTopic
(
file
,
title
,
os
.
path
.
join
(
path
,
file
))
ht
=
HelpTopic
.
STXTopic
(
file
,
title
,
os
.
path
.
join
(
path
,
file
))
self
.
registerHelpTopic
(
file
,
ht
)
self
.
registerHelpTopic
(
file
,
ht
)
elif
ext
in
(
'.jpg'
,
'.gif'
,
'.png'
):
elif
ext
in
(
'.jpg'
,
'.gif'
,
'.png'
):
...
...
lib/python/App/RefreshFuncs.py
View file @
d0de6597
...
@@ -12,12 +12,11 @@
...
@@ -12,12 +12,11 @@
##############################################################################
##############################################################################
'''
'''
Functions for refreshing products.
Functions for refreshing products.
$Id: RefreshFuncs.py,v 1.
3 2001/11/28 15:50:52 matt
Exp $
$Id: RefreshFuncs.py,v 1.
4 2002/02/07 17:37:10 andreasjung
Exp $
'''
'''
import
os
,
sys
import
os
,
sys
from
time
import
time
from
time
import
time
from
string
import
split
,
join
import
Products
import
Products
from
ExtensionClass
import
Base
from
ExtensionClass
import
Base
from
Globals
import
PersistentMapping
from
Globals
import
PersistentMapping
...
@@ -255,7 +254,7 @@ def setupModTimes(productid):
...
@@ -255,7 +254,7 @@ def setupModTimes(productid):
exists
=
os
.
path
.
exists
exists
=
os
.
path
.
exists
for
name
,
module
in
modlist
:
for
name
,
module
in
modlist
:
splitname
=
split
(
name
,
'.'
)[
2
:]
splitname
=
name
.
split
(
'.'
)[
2
:]
if
not
splitname
:
if
not
splitname
:
filename
=
'__init__'
filename
=
'__init__'
else
:
else
:
...
...
lib/python/App/Undo.py
View file @
d0de6597
...
@@ -12,12 +12,11 @@
...
@@ -12,12 +12,11 @@
##############################################################################
##############################################################################
__doc__
=
'''short description
__doc__
=
'''short description
$Id: Undo.py,v 1.2
7 2001/11/28 15:50:52 matt
Exp $'''
$Id: Undo.py,v 1.2
8 2002/02/07 17:37:10 andreasjung
Exp $'''
__version__
=
'$Revision: 1.2
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
8
$'
[
11
:
-
2
]
import
Globals
,
ExtensionClass
import
Globals
,
ExtensionClass
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
string
import
atof
,
find
,
atoi
,
split
,
rfind
,
join
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
import
base64
import
base64
...
@@ -99,7 +98,7 @@ class UndoSupport(ExtensionClass.Base):
...
@@ -99,7 +98,7 @@ class UndoSupport(ExtensionClass.Base):
desc
=
d
[
'description'
]
desc
=
d
[
'description'
]
tid
=
d
[
'id'
]
tid
=
d
[
'id'
]
if
desc
:
if
desc
:
desc
=
split
(
desc
)
desc
=
desc
.
split
(
)
d1
=
desc
[
0
]
d1
=
desc
[
0
]
desc
=
join
(
desc
[
1
:])
desc
=
join
(
desc
[
1
:])
if
len
(
desc
)
>
60
:
desc
=
desc
[:
56
]
+
' ...'
if
len
(
desc
)
>
60
:
desc
=
desc
[:
56
]
+
' ...'
...
@@ -116,7 +115,7 @@ class UndoSupport(ExtensionClass.Base):
...
@@ -116,7 +115,7 @@ class UndoSupport(ExtensionClass.Base):
"""
"""
undo
=
Globals
.
UndoManager
.
undo
undo
=
Globals
.
UndoManager
.
undo
for
tid
in
transaction_info
:
for
tid
in
transaction_info
:
tid
=
split
(
tid
)
tid
=
tid
.
split
(
)
if
tid
:
if
tid
:
get_transaction
().
note
(
"Undo %s"
%
join
(
tid
[
1
:]))
get_transaction
().
note
(
"Undo %s"
%
join
(
tid
[
1
:]))
tid
=
decode64
(
tid
[
0
])
tid
=
decode64
(
tid
[
0
])
...
...
lib/python/App/tar.py
View file @
d0de6597
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
##############################################################################
##############################################################################
__doc__
=
'''Simple module for writing tar files
__doc__
=
'''Simple module for writing tar files
$Id: tar.py,v 1.
4 2001/11/28 15:50:53 matt
Exp $'''
$Id: tar.py,v 1.
5 2002/02/07 17:37:10 andreasjung
Exp $'''
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
import
sys
,
time
,
zlib
import
sys
,
time
,
zlib
try
:
try
:
...
@@ -22,8 +22,6 @@ except:
...
@@ -22,8 +22,6 @@ except:
from
struct
import
pack
from
struct
import
pack
from
string
import
find
,
join
def
oct8
(
i
):
def
oct8
(
i
):
i
=
oct
(
i
)
i
=
oct
(
i
)
return
'0'
*
(
6
-
len
(
i
))
+
i
+
'
\
0
'
return
'0'
*
(
6
-
len
(
i
))
+
i
+
'
\
0
'
...
@@ -45,7 +43,7 @@ class TarEntry:
...
@@ -45,7 +43,7 @@ class TarEntry:
"Initialize a Tar archive entry"
"Initialize a Tar archive entry"
self
.
data
=
data
self
.
data
=
data
if
mtime
is
None
:
mtime
=
int
(
time
.
time
())
if
mtime
is
None
:
mtime
=
int
(
time
.
time
())
header
=
join
([
header
=
''
.
join
([
pad
(
path
,
100
),
pad
(
path
,
100
),
oct8
(
mode
),
oct8
(
mode
),
oct8
(
uid
),
oct8
(
uid
),
...
@@ -63,7 +61,7 @@ class TarEntry:
...
@@ -63,7 +61,7 @@ class TarEntry:
'000000
\
0
'
,
'000000
\
0
'
,
pad
(
prefix
,
155
),
pad
(
prefix
,
155
),
'
\
0
'
*
12
,
'
\
0
'
*
12
,
]
,
''
)
])
if
len
(
header
)
!=
512
:
raise
'Bad Header Length'
,
len
(
header
)
if
len
(
header
)
!=
512
:
raise
'Bad Header Length'
,
len
(
header
)
header
=
(
header
[:
148
]
+
header
=
(
header
[:
148
]
+
oct8
(
reduce
(
lambda
a
,
b
:
a
+
b
,
map
(
ord
,
header
)))
+
oct8
(
reduce
(
lambda
a
,
b
:
a
+
b
,
map
(
ord
,
header
)))
+
...
@@ -82,7 +80,7 @@ def tar(entries):
...
@@ -82,7 +80,7 @@ def tar(entries):
for
name
,
data
in
entries
:
for
name
,
data
in
entries
:
ra
(
str
(
TarEntry
(
name
,
data
)))
ra
(
str
(
TarEntry
(
name
,
data
)))
ra
(
'
\
0
'
*
1024
)
ra
(
'
\
0
'
*
1024
)
return
join
(
r
,
''
)
return
''
.
join
(
r
)
def
tgz
(
entries
):
def
tgz
(
entries
):
c
=
zlib
.
compressobj
()
c
=
zlib
.
compressobj
()
...
@@ -93,7 +91,7 @@ def tgz(entries):
...
@@ -93,7 +91,7 @@ def tgz(entries):
ra
(
compress
(
str
(
TarEntry
(
name
,
data
))))
ra
(
compress
(
str
(
TarEntry
(
name
,
data
))))
ra
(
compress
(
'
\
0
'
*
1024
))
ra
(
compress
(
'
\
0
'
*
1024
))
ra
(
c
.
flush
())
ra
(
c
.
flush
())
return
join
(
r
,
''
)
return
''
.
join
(
r
)
class
tgzarchive
:
class
tgzarchive
:
...
@@ -135,4 +133,4 @@ class gzFile:
...
@@ -135,4 +133,4 @@ class gzFile:
append
(
self
.
_c
.
flush
())
append
(
self
.
_c
.
flush
())
append
(
pack
(
"<i"
,
self
.
_crc
))
append
(
pack
(
"<i"
,
self
.
_crc
))
append
(
pack
(
"<i"
,
self
.
_l
))
append
(
pack
(
"<i"
,
self
.
_l
))
return
join
(
r
,
''
)
return
''
.
join
(
r
)
lib/python/App/version_txt.py
View file @
d0de6597
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
##############################################################################
##############################################################################
import
os
,
sys
,
string
,
re
import
os
,
sys
,
re
v
=
sys
.
version_info
v
=
sys
.
version_info
...
...
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