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
9b42bfaf
Commit
9b42bfaf
authored
Nov 04, 2005
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- extended warning time for removal of old-style product metadata support
parent
69488145
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
4 deletions
+71
-4
doc/CHANGES.txt
doc/CHANGES.txt
+0
-3
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+71
-1
No files found.
doc/CHANGES.txt
View file @
9b42bfaf
...
...
@@ -75,9 +75,6 @@ Zope Changes
Other
- OFS Application: Removed support for long deprecated old-style product
metadata in the __init__.py of products.
- ZSQLMethod.manage_main: Moved the error message that warns of a
non-existing or closed database connection next to the Connection ID
dropdown and present it using red to increase its visibility.
...
...
lib/python/OFS/Application.py
View file @
9b42bfaf
...
...
@@ -18,6 +18,7 @@ $Id$
import
os
,
sys
,
traceback
from
cgi
import
escape
from
StringIO
import
StringIO
from
warnings
import
warn
import
Globals
,
Products
,
App
.
Product
,
App
.
ProductRegistry
import
transaction
...
...
@@ -781,11 +782,80 @@ def install_product(app, product_dir, product_name, meta_types,
product
,
product_name
,
package_dir
,
app
)
context
=
ProductContext
(
productObject
,
app
,
product
)
# Look for an 'initialize' method in the product.
# Look for an 'initialize' method in the product. If it does
# not exist, then this is an old product that has never been
# updated. In that case, we will analyze the product and
# build up enough information to do initialization manually.
initmethod
=
pgetattr
(
product
,
'initialize'
,
None
)
if
initmethod
is
not
None
:
initmethod
(
context
)
# Support old-style product metadata. Older products may
# define attributes to name their permissions, meta_types,
# constructors, etc.
permissions
=
{}
new_permissions
=
{}
if
pgetattr
(
product
,
'__ac_permissions__'
,
None
)
is
not
None
:
warn
(
'__init__.py of %s has a long deprecated '
'
\
'
__ac_permissions__
\
'
attribute. '
'
\
'
__ac_permissions__
\
'
will be ignored by '
'install_product in Zope 2.10. Please use registerClass '
'instead.'
%
product
.
__name__
,
DeprecationWarning
)
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
]
=
()
if
pgetattr
(
product
,
'meta_types'
,
None
)
is
not
None
:
warn
(
'__init__.py of %s has a long deprecated
\
'
meta_types
\
'
'
'attribute.
\
'
meta_types
\
'
will be ignored by '
'install_product in Zope 2.10. Please use registerClass '
'instead.'
%
product
.
__name__
,
DeprecationWarning
)
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_type
[
'visibility'
]
=
'Global'
meta_types
.
append
(
meta_type
)
if
pgetattr
(
product
,
'methods'
,
None
)
is
not
None
:
warn
(
'__init__.py of %s has a long deprecated
\
'
methods
\
'
'
'attribute.
\
'
methods
\
'
will be ignored by '
'install_product in Zope 2.10. Please use registerClass '
'instead.'
%
product
.
__name__
,
DeprecationWarning
)
for
name
,
method
in
pgetattr
(
product
,
'methods'
,
{}).
items
():
if
not
hasattr
(
Folder
.
Folder
,
name
):
setattr
(
Folder
.
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
.
Folder
.
__ac_permissions__
=
tuple
(
list
(
Folder
.
Folder
.
__ac_permissions__
)
+
new_permissions
)
if
not
doInstall
():
transaction
().
abort
()
else
:
...
...
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