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
6e6e3eef
Commit
6e6e3eef
authored
24 years ago
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged fix for product initialization from 2.2 branch
parent
cd556920
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
45 deletions
+48
-45
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+48
-45
No files found.
lib/python/OFS/Application.py
View file @
6e6e3eef
...
@@ -85,8 +85,8 @@
...
@@ -85,8 +85,8 @@
__doc__
=
'''Application support
__doc__
=
'''Application support
$Id: Application.py,v 1.13
1 2000/08/02 17:31:54
brian Exp $'''
$Id: Application.py,v 1.13
2 2000/08/10 14:22:48
brian Exp $'''
__version__
=
'$Revision: 1.13
1
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.13
2
$'
[
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
...
@@ -485,49 +485,52 @@ def install_products(app):
...
@@ -485,49 +485,52 @@ def install_products(app):
initmethod
=
pgetattr
(
product
,
'initialize'
,
None
)
initmethod
=
pgetattr
(
product
,
'initialize'
,
None
)
if
initmethod
is
not
None
:
if
initmethod
is
not
None
:
initmethod
(
context
)
initmethod
(
context
)
else
:
permissions
=
{}
# Support old-style product metadata. Older products may
new_permissions
=
{}
# define attributes to name their permissions, meta_types,
for
p
in
pgetattr
(
product
,
'__ac_permissions__'
,
()):
# constructors, etc.
permission
,
names
,
default
=
(
permissions
=
{}
tuple
(
p
)
+
(
'Manager'
,))[:
3
]
new_permissions
=
{}
if
names
:
for
p
in
pgetattr
(
product
,
'__ac_permissions__'
,
()):
for
name
in
names
:
permission
,
names
,
default
=
(
permissions
[
name
]
=
permission
tuple
(
p
)
+
(
'Manager'
,))[:
3
]
elif
not
folder_permissions
.
has_key
(
permission
):
if
names
:
new_permissions
[
permission
]
=
()
for
name
in
names
:
permissions
[
name
]
=
permission
for
meta_type
in
pgetattr
(
product
,
'meta_types'
,
()):
elif
not
folder_permissions
.
has_key
(
permission
):
# Modern product initialization via a ProductContext
new_permissions
[
permission
]
=
()
# adds 'product' and 'permission' keys to the meta_type
# mapping. We have to add these here for old products.
for
meta_type
in
pgetattr
(
product
,
'meta_types'
,
()):
pname
=
permissions
.
get
(
meta_type
[
'action'
],
None
)
# Modern product initialization via a ProductContext
if
pname
is
not
None
:
# adds 'product' and 'permission' keys to the meta_type
meta_type
[
'permission'
]
=
pname
# mapping. We have to add these here for old products.
meta_type
[
'product'
]
=
productObject
.
id
pname
=
permissions
.
get
(
meta_type
[
'action'
],
None
)
meta_types
.
append
(
meta_type
)
if
pname
is
not
None
:
meta_type
[
'permission'
]
=
pname
for
name
,
method
in
pgetattr
(
meta_type
[
'product'
]
=
productObject
.
id
product
,
'methods'
,
{}).
items
():
meta_types
.
append
(
meta_type
)
if
not
hasattr
(
Folder
,
name
):
setattr
(
Folder
,
name
,
method
)
for
name
,
method
in
pgetattr
(
if
name
[
-
9
:]
!=
'__roles__'
:
# not Just setting roles
product
,
'methods'
,
{}).
items
():
if
(
permissions
.
has_key
(
name
)
and
if
not
hasattr
(
Folder
,
name
):
not
folder_permissions
.
has_key
(
setattr
(
Folder
,
name
,
method
)
permissions
[
name
])):
if
name
[
-
9
:]
!=
'__roles__'
:
# not Just setting roles
permission
=
permissions
[
name
]
if
(
permissions
.
has_key
(
name
)
and
if
new_permissions
.
has_key
(
permission
):
not
folder_permissions
.
has_key
(
new_permissions
[
permission
].
append
(
name
)
permissions
[
name
])):
else
:
permission
=
permissions
[
name
]
new_permissions
[
permission
]
=
[
name
]
if
new_permissions
.
has_key
(
permission
):
new_permissions
[
permission
].
append
(
name
)
if
new_permissions
:
else
:
new_permissions
=
new_permissions
.
items
()
new_permissions
[
permission
]
=
[
name
]
for
permission
,
names
in
new_permissions
:
folder_permissions
[
permission
]
=
names
if
new_permissions
:
new_permissions
.
sort
()
new_permissions
=
new_permissions
.
items
()
Folder
.
__dict__
[
'__ac_permissions__'
]
=
tuple
(
for
permission
,
names
in
new_permissions
:
list
(
Folder
.
__ac_permissions__
)
+
new_permissions
)
folder_permissions
[
permission
]
=
names
new_permissions
.
sort
()
Folder
.
__dict__
[
'__ac_permissions__'
]
=
tuple
(
list
(
Folder
.
__ac_permissions__
)
+
new_permissions
)
if
os
.
environ
.
get
(
'ZEO_CLIENT'
,
''
):
if
os
.
environ
.
get
(
'ZEO_CLIENT'
,
''
):
# we don't want to install products from clients!
# we don't want to install products from clients!
...
...
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