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
9b4ac939
Commit
9b4ac939
authored
Dec 19, 1997
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now product __init__s can omit __ foolishness.
Now products can define misc objects.
parent
8b34ba90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
17 deletions
+39
-17
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+39
-17
No files found.
lib/python/OFS/Application.py
View file @
9b4ac939
...
...
@@ -11,8 +11,8 @@
__doc__
=
'''Application support
$Id: Application.py,v 1.3
0 1997/12/18 18:42:07
jim Exp $'''
__version__
=
'$Revision: 1.3
0
$'
[
11
:
-
2
]
$Id: Application.py,v 1.3
1 1997/12/19 15:37:34
jim Exp $'''
__version__
=
'$Revision: 1.3
1
$'
[
11
:
-
2
]
import
Globals
,
Folder
,
os
,
regex
,
sys
...
...
@@ -29,6 +29,10 @@ class Application(Folder.Folder):
__defined_roles__
=
(
'manage'
,)
web__form__method
=
'GET'
class
misc_
:
"Miscellaneous product information"
__roles__
=
None
manage_options
=
(
{
'icon'
:
'OFS/Folder_icon.gif'
,
'label'
:
'Contents'
,
'action'
:
'manage_main'
,
'target'
:
'manage_main'
},
...
...
@@ -170,10 +174,9 @@ def install_products():
product_dir
=
path_join
(
SOFTWARE_HOME
,
'Products'
)
isdir
=
os
.
path
.
isdir
exists
=
os
.
path
.
exists
DictType
=
type
({})
app
=
Globals
.
Bobobase
[
'Application'
]
meta_types
=
list
(
Folder
.
Folder
.
dynamic_meta_types
)
role_names
=
list
(
app
.
__defined_roles__
)
product_names
=
os
.
listdir
(
product_dir
)
product_names
.
sort
()
...
...
@@ -183,7 +186,8 @@ def install_products():
if
not
isdir
(
package_dir
):
continue
if
not
exists
(
path_join
(
package_dir
,
'__init__.py'
)):
continue
product
=
__import__
(
product_name
)
for
meta_type
in
product
.
meta_types
:
for
meta_type
in
pgetattr
(
product
,
'meta_types'
,
()):
if
product_name
==
'OFS'
:
meta_types
.
insert
(
0
,
meta_type
)
else
:
meta_types
.
append
(
meta_type
)
name
=
meta_type
[
'name'
]
...
...
@@ -222,27 +226,45 @@ def install_products():
setattr
(
Folder
.
Folder
,
"%sItems"
%
prefix
,
productItems
)
for
name
,
method
in
p
roduct
.
methods
.
items
():
for
name
,
method
in
p
getattr
(
product
,
'methods'
,
{})
.
items
():
setattr
(
Folder
.
Folder
,
name
,
method
)
# Try to install role names
try
:
for
n
in
product
.
role_names
:
if
n
not
in
role_names
:
role_names
.
append
(
n
)
except
:
pass
misc_
=
pgetattr
(
product
,
'misc_'
,
{})
if
type
(
misc_
)
is
DictType
:
misc_
=
Misc_
(
product_name
,
misc_
)
Application
.
misc_
.
__dict__
[
product_name
]
=
misc_
Folder
.
Folder
.
dynamic_meta_types
=
tuple
(
meta_types
)
role_names
.
sort
()
role_names
=
tuple
(
role_names
)
if
app
.
__defined_roles__
!=
role_names
:
app
.
__defined_roles__
=
tuple
(
role_names
)
def
pgetattr
(
product
,
name
,
default
=
install_products
):
if
hasattr
(
product
,
name
):
return
getattr
(
product
,
name
)
if
hasattr
(
product
,
'__init__'
):
product
=
product
.
__init__
if
hasattr
(
product
,
name
):
return
getattr
(
product
,
name
)
if
default
is
not
install_products
:
return
default
raise
AttributeError
,
name
class
Misc_
:
"Miscellaneous product information"
__roles__
=
None
def
__init__
(
self
,
name
,
dict
):
self
.
_d
=
dict
self
.
__name__
=
name
def
__str__
(
self
):
return
self
.
__name__
def
__getitem__
(
self
,
name
):
return
self
.
_d
[
name
]
##############################################################################
#
# $Log: Application.py,v $
# Revision 1.31 1997/12/19 15:37:34 jim
# Now product __init__s can omit __ foolishness.
# Now products can define misc objects.
#
# Revision 1.30 1997/12/18 18:42:07 jim
# Rearranged things to make fixup "products" work.
#
...
...
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