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
50085536
Commit
50085536
authored
Oct 13, 2005
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- minor code modernization (to make reading the code easier)
parent
404d00a0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
lib/python/App/ProductContext.py
lib/python/App/ProductContext.py
+14
-10
No files found.
lib/python/App/ProductContext.py
View file @
50085536
...
...
@@ -7,11 +7,14 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
.
#
##############################################################################
"""Objects providing context for product initialization
$Id$
"""
from
AccessControl.PermissionRole
import
PermissionRole
import
Globals
,
os
,
OFS
.
ObjectManager
,
OFS
.
misc_
,
Products
import
AccessControl.Permission
...
...
@@ -22,7 +25,6 @@ from zLOG import LOG, WARNING
import
os.path
,
re
import
stat
from
DateTime
import
DateTime
from
types
import
ListType
,
TupleType
from
Interface.Implements
import
instancesOfObjectImplements
from
App.Product
import
doInstall
...
...
@@ -101,7 +103,6 @@ class ProductContext:
app
=
self
.
__app
pack
=
self
.
__pack
initial
=
constructors
[
0
]
tt
=
type
(())
productObject
=
self
.
__prod
pid
=
productObject
.
id
...
...
@@ -112,11 +113,11 @@ class ProductContext:
OM
=
OFS
.
ObjectManager
.
ObjectManager
if
permissions
:
if
type
(
permissions
)
is
type
(
''
):
# You goofed it!
if
isinstance
(
permissions
,
basestring
):
# You goofed it!
raise
TypeError
,
(
'Product context permissions should be a '
'list of permissions not a string'
,
permissions
)
for
p
in
permissions
:
if
type
(
p
)
is
tt
:
if
isinstance
(
p
,
tuple
)
:
p
,
default
=
p
AccessControl
.
Permission
.
registerPermissions
(
((
p
,
(),
default
),))
...
...
@@ -129,7 +130,7 @@ class ProductContext:
if
permission
is
None
:
permission
=
"Add %ss"
%
(
meta_type
or
instance_class
.
meta_type
)
if
type
(
permission
)
is
tt
:
if
isinstance
(
permission
,
tuple
)
:
permission
,
default
=
permission
else
:
default
=
(
'Manager'
,)
...
...
@@ -140,7 +141,7 @@ class ProductContext:
############################################################
for
method
in
legacy
:
if
type
(
method
)
is
tt
:
if
isinstance
(
method
,
tuple
)
:
name
,
method
=
method
aliased
=
1
else
:
...
...
@@ -156,8 +157,10 @@ class ProductContext:
setattr
(
OM
,
method
.
__name__
,
method
)
setattr
(
OM
,
method
.
__name__
+
'__roles__'
,
pr
)
if
type
(
initial
)
is
tt
:
name
,
initial
=
initial
else
:
name
=
initial
.
__name__
if
isinstance
(
initial
,
tuple
):
name
,
initial
=
initial
else
:
name
=
initial
.
__name__
fd
=
getattr
(
pack
,
'__FactoryDispatcher__'
,
None
)
if
fd
is
None
:
...
...
@@ -192,7 +195,8 @@ class ProductContext:
m
[
name
+
'__roles__'
]
=
pr
for
method
in
constructors
[
1
:]:
if
type
(
method
)
is
tt
:
name
,
method
=
method
if
isinstance
(
method
,
tuple
):
name
,
method
=
method
else
:
name
=
os
.
path
.
split
(
method
.
__name__
)[
-
1
]
if
not
productObject
.
__dict__
.
has_key
(
name
):
...
...
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