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
Aug 10, 2000
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 @@
__doc__
=
'''Application support
$Id: Application.py,v 1.13
1 2000/08/02 17:31:54
brian Exp $'''
__version__
=
'$Revision: 1.13
1
$'
[
11
:
-
2
]
$Id: Application.py,v 1.13
2 2000/08/10 14:22:48
brian Exp $'''
__version__
=
'$Revision: 1.13
2
$'
[
11
:
-
2
]
import
Globals
,
Folder
,
os
,
sys
,
App
.
Product
,
App
.
ProductRegistry
,
misc_
import
time
,
traceback
,
os
,
string
,
Products
...
...
@@ -485,49 +485,52 @@ def install_products(app):
initmethod
=
pgetattr
(
product
,
'initialize'
,
None
)
if
initmethod
is
not
None
:
initmethod
(
context
)
else
:
permissions
=
{}
new_permissions
=
{}
for
p
in
pgetattr
(
product
,
'__ac_permissions__'
,
()):
permission
,
names
,
default
=
(
tuple
(
p
)
+
(
'Manager'
,))[:
3
]
if
names
:
for
name
in
names
:
permissions
[
name
]
=
permission
elif
not
folder_permissions
.
has_key
(
permission
):
new_permissions
[
permission
]
=
()
for
meta_type
in
pgetattr
(
product
,
'meta_types'
,
()):
# Modern product initialization via a ProductContext
# adds 'product' and 'permission' keys to the meta_type
# mapping. We have to add these here for old products.
pname
=
permissions
.
get
(
meta_type
[
'action'
],
None
)
if
pname
is
not
None
:
meta_type
[
'permission'
]
=
pname
meta_type
[
'product'
]
=
productObject
.
id
meta_types
.
append
(
meta_type
)
for
name
,
method
in
pgetattr
(
product
,
'methods'
,
{}).
items
():
if
not
hasattr
(
Folder
,
name
):
setattr
(
Folder
,
name
,
method
)
if
name
[
-
9
:]
!=
'__roles__'
:
# not Just setting roles
if
(
permissions
.
has_key
(
name
)
and
not
folder_permissions
.
has_key
(
permissions
[
name
])):
permission
=
permissions
[
name
]
if
new_permissions
.
has_key
(
permission
):
new_permissions
[
permission
].
append
(
name
)
else
:
new_permissions
[
permission
]
=
[
name
]
if
new_permissions
:
new_permissions
=
new_permissions
.
items
()
for
permission
,
names
in
new_permissions
:
folder_permissions
[
permission
]
=
names
new_permissions
.
sort
()
Folder
.
__dict__
[
'__ac_permissions__'
]
=
tuple
(
list
(
Folder
.
__ac_permissions__
)
+
new_permissions
)
# Support old-style product metadata. Older products may
# define attributes to name their permissions, meta_types,
# constructors, etc.
permissions
=
{}
new_permissions
=
{}
for
p
in
pgetattr
(
product
,
'__ac_permissions__'
,
()):
permission
,
names
,
default
=
(
tuple
(
p
)
+
(
'Manager'
,))[:
3
]
if
names
:
for
name
in
names
:
permissions
[
name
]
=
permission
elif
not
folder_permissions
.
has_key
(
permission
):
new_permissions
[
permission
]
=
()
for
meta_type
in
pgetattr
(
product
,
'meta_types'
,
()):
# Modern product initialization via a ProductContext
# adds 'product' and 'permission' keys to the meta_type
# mapping. We have to add these here for old products.
pname
=
permissions
.
get
(
meta_type
[
'action'
],
None
)
if
pname
is
not
None
:
meta_type
[
'permission'
]
=
pname
meta_type
[
'product'
]
=
productObject
.
id
meta_types
.
append
(
meta_type
)
for
name
,
method
in
pgetattr
(
product
,
'methods'
,
{}).
items
():
if
not
hasattr
(
Folder
,
name
):
setattr
(
Folder
,
name
,
method
)
if
name
[
-
9
:]
!=
'__roles__'
:
# not Just setting roles
if
(
permissions
.
has_key
(
name
)
and
not
folder_permissions
.
has_key
(
permissions
[
name
])):
permission
=
permissions
[
name
]
if
new_permissions
.
has_key
(
permission
):
new_permissions
[
permission
].
append
(
name
)
else
:
new_permissions
[
permission
]
=
[
name
]
if
new_permissions
:
new_permissions
=
new_permissions
.
items
()
for
permission
,
names
in
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'
,
''
):
# we don't want to install products from clients!
...
...
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