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
d5f5d75a
Commit
d5f5d75a
authored
Jun 27, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also disable product installation in the default test configuration
parent
4e3afdb3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
46 deletions
+17
-46
src/App/config.py
src/App/config.py
+1
-1
src/OFS/tests/test_registerpackage.py
src/OFS/tests/test_registerpackage.py
+2
-15
src/Products/ZODBMountPoint/MountedObject.py
src/Products/ZODBMountPoint/MountedObject.py
+2
-6
src/Products/ZODBMountPoint/__init__.py
src/Products/ZODBMountPoint/__init__.py
+0
-3
src/Products/ZODBMountPoint/tests/testMountPoint.py
src/Products/ZODBMountPoint/tests/testMountPoint.py
+12
-21
No files found.
src/App/config.py
View file @
d5f5d75a
...
...
@@ -86,7 +86,7 @@ class DefaultConfiguration:
self
.
zopehome
=
FindHomes
.
ZOPE_HOME
self
.
dbtab
=
None
self
.
debug_mode
=
True
self
.
enable_product_installation
=
Tru
e
self
.
enable_product_installation
=
Fals
e
self
.
locale
=
None
# restructured text
...
...
src/OFS/tests/test_registerpackage.py
View file @
d5f5d75a
...
...
@@ -12,8 +12,6 @@
#
##############################################################################
"""Unit tests for the registerPackage directive.
$Id$
"""
import
sys
...
...
@@ -50,26 +48,15 @@ def test_registerPackage():
We need to load the product as well. This would normally happen during
Zope startup, but in the test, we're already too late.
>>> import Zope2
>>> from OFS.Application import install_products
>>> app = Zope2.app()
>>> install_products(app)
pythonproduct2 initialized
Test to see if the pythonproduct2 python package actually gets setup
as a zope2 product in the Control Panel.
>>> product_listing = []
>>> try:
... product_listing = app.Control_Panel.Products.objectIds()
... finally:
... app._p_jar.close()
>>> 'pythonproduct2' in product_listing
True
Make sure it
also
shows up in ``Products._registered_packages``.
Make sure it shows up in ``Products._registered_packages``.
>>> [x.__name__ for x in getattr(Products, '_registered_packages', [])]
['pythonproduct2']
...
...
src/Products/ZODBMountPoint/MountedObject.py
View file @
d5f5d75a
...
...
@@ -25,13 +25,13 @@ from logging import getLogger
import
transaction
from
AccessControl.class_init
import
InitializeClass
from
AccessControl.ZopeGuards
import
guarded_getattr
from
Acquisition
import
ImplicitAcquisitionWrapper
from
Acquisition
import
aq_base
from
Acquisition
import
aq_inner
from
Acquisition
import
aq_parent
from
OFS.SimpleItem
import
SimpleItem
from
OFS.Folder
import
Folder
from
OFS.Folder
import
manage_addFolder
from
Products.PageTemplates.PageTemplateFile
import
PageTemplateFile
LOG
=
getLogger
(
'Zope.ZODBMountPoint'
)
...
...
@@ -55,9 +55,7 @@ class SimpleTrailblazer:
def
_construct
(
self
,
context
,
id
):
"""Creates and returns the named folder."""
dispatcher
=
guarded_getattr
(
context
,
'manage_addProduct'
)[
'OFSP'
]
factory
=
guarded_getattr
(
dispatcher
,
'manage_addFolder'
)
factory
(
id
)
manage_addFolder
(
context
,
id
)
o
=
context
.
restrictedTraverse
(
id
)
context
.
_p_jar
.
add
(
aq_base
(
o
))
return
o
...
...
@@ -391,5 +389,3 @@ def manage_addMounts(dispatcher, paths=(), create_mount_points=True,
REQUEST
[
'RESPONSE'
].
redirect
(
REQUEST
[
'URL1'
]
+
(
'/manage_main?manage_tabs_message='
'Added %d mount points.'
%
count
))
src/Products/ZODBMountPoint/__init__.py
View file @
d5f5d75a
...
...
@@ -25,6 +25,3 @@ def initialize(context):
MountedObject
.
manage_getMountStatus
,
MountedObject
.
manage_addMounts
,),
)
src/Products/ZODBMountPoint/tests/testMountPoint.py
View file @
d5f5d75a
...
...
@@ -15,10 +15,12 @@
"""
import
os
import
os.path
import
sys
import
unittest
import
transaction
from
OFS.Application
import
Application
from
OFS.Application
import
get_folder_permissions
from
OFS.Folder
import
Folder
import
App.config
from
Products.ZODBMountPoint.MountedObject
import
manage_addMounts
...
...
@@ -78,7 +80,7 @@ class MountingTests(unittest.TestCase):
if
original_config
is
None
:
# stow away original config so we can reset it
original_config
=
App
.
config
.
getConfiguration
()
databases
=
[
TestDBConfig
(
'test_main.fs'
,
[
'/'
]).
getDB
(),
TestDBConfig
(
'test_mount1.fs'
,
[
'/mount1'
]).
getDB
(),
TestDBConfig
(
'test_mount2.fs'
,
[
'/mount2'
]).
getDB
(),
...
...
@@ -95,6 +97,7 @@ class MountingTests(unittest.TestCase):
conf
=
DBTab
(
mount_factories
,
mount_points
)
d
=
App
.
config
.
DefaultConfiguration
()
d
.
dbtab
=
conf
d
.
enable_product_installation
=
True
App
.
config
.
setConfiguration
(
d
)
self
.
conf
=
conf
db
=
conf
.
getDatabase
(
'/'
)
...
...
@@ -102,7 +105,9 @@ class MountingTests(unittest.TestCase):
root
=
conn
.
root
()
root
[
'Application'
]
=
app
=
Application
()
self
.
app
=
app
install_products
(
app
,
'ZCatalog'
,
'PluginIndexes'
,
'OFSP'
)
install_product
(
app
,
'ZCatalog'
)
install_product
(
app
,
'PluginIndexes'
)
install_product
(
app
,
'OFSP'
)
# login
from
AccessControl.User
import
system
from
AccessControl.SecurityManagement
import
newSecurityManager
...
...
@@ -111,8 +116,6 @@ class MountingTests(unittest.TestCase):
manage_addMounts
(
app
,
(
'/mount1'
,
'/mount2'
,
'/i/mount3'
))
transaction
.
commit
()
# Get the mount points ready
def
tearDown
(
self
):
# logout
from
AccessControl.SecurityManagement
import
noSecurityManager
...
...
@@ -228,25 +231,13 @@ class MountingTests(unittest.TestCase):
self
.
assertEqual
(
conn2
.
opened
,
None
)
self
.
assertEqual
(
conn3
.
opened
,
None
)
def
install_products
(
app
,
*
prod
):
"""auxiliary function to install products *prod* (by names)."""
from
OFS.Application
import
get_folder_permissions
,
get_products
,
install_product
folder_permissions
=
get_folder_permissions
()
meta_types
=
[]
done
=
{}
products
=
get_products
()
for
priority
,
product_name
,
index
,
product_dir
in
products
:
if
product_name
not
in
prod
or
product_name
in
done
:
continue
done
[
product_name
]
=
1
install_product
(
app
,
product_dir
,
product_name
,
meta_types
,
folder_permissions
,
raise_exc
=
True
)
def
install_product
(
app
,
product_name
):
from
OFS.Application
import
install_product
product_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
os
.
pardir
,
os
.
pardir
)
install_product
(
app
,
product_dir
,
product_name
,
[],
get_folder_permissions
(),
raise_exc
=
True
)
def
test_suite
():
return
unittest
.
makeSuite
(
MountingTests
,
'test'
)
if
__name__
==
'__main__'
:
unittest
.
main
()
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