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
41e49edc
Commit
41e49edc
authored
Jan 05, 2003
by
Chris McDonough
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use config data for App.startup but still use custom_zodb if it's defined.
parent
faf72340
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
lib/python/Zope/App/startup.py
lib/python/Zope/App/startup.py
+23
-7
No files found.
lib/python/Zope/App/startup.py
View file @
41e49edc
...
@@ -31,25 +31,38 @@ import AccessControl.User
...
@@ -31,25 +31,38 @@ import AccessControl.User
import
ZPublisher
import
ZPublisher
import
ExtensionClass
import
ExtensionClass
from
zLOG
import
LOG
,
WARNING
,
INFO
,
BLATHER
,
log_time
from
zLOG
import
LOG
,
WARNING
,
INFO
,
BLATHER
,
log_time
from
Zope
import
Startup
def
startup
():
def
startup
():
config
=
Startup
.
getConfiguration
()
global
ZODB
,
app
global
ZODB
,
app
Globals
.
BobobaseName
=
os
.
path
.
join
(
Globals
.
data_dir
,
'Data.fs'
)
Globals
.
DatabaseVersion
=
'3'
Globals
.
DatabaseVersion
=
'3'
# Import products
# Import products
OFS
.
Application
.
import_products
()
OFS
.
Application
.
import_products
()
# Open the database
# Set up a root database from zconfig data
zconfig_db
=
None
set_root
=
0
for
mount_points
,
dbfactory
in
config
.
databases
:
# only use root for now
if
'/'
in
mount_points
:
if
set_root
:
raise
ConfigurationError
,
(
"Cannot specify more than one 'root' / database"
)
zconfig_db
=
dbfactory
()
Globals
.
BobobaseName
=
zconfig_db
.
getName
()
set_root
=
1
try
:
try
:
#
Try to use custom storage
#
Root db/storage in custom_zodb overrides zconfig_db
m
=
imp
.
find_module
(
'custom_zodb'
,[
INSTANCE_HOME
])
m
=
imp
.
find_module
(
'custom_zodb'
,[
INSTANCE_HOME
])
except
:
except
:
import
ZODB.FileStorage
DB
=
zconfig_db
storage
=
ZODB
.
FileStorage
.
FileStorage
(
Globals
.
BobobaseName
)
DB
=
ZODB
.
DB
(
storage
)
else
:
else
:
m
=
imp
.
load_module
(
'Zope.custom_zodb'
,
m
[
0
],
m
[
1
],
m
[
2
])
m
=
imp
.
load_module
(
'Zope.custom_zodb'
,
m
[
0
],
m
[
1
],
m
[
2
])
if
hasattr
(
m
,
'DB'
):
if
hasattr
(
m
,
'DB'
):
...
@@ -61,6 +74,9 @@ def startup():
...
@@ -61,6 +74,9 @@ def startup():
Globals
.
BobobaseName
=
DB
.
getName
()
Globals
.
BobobaseName
=
DB
.
getName
()
sys
.
modules
[
'Zope.custom_zodb'
]
=
m
sys
.
modules
[
'Zope.custom_zodb'
]
=
m
if
DB
is
None
:
raise
Startup
.
ConfigurationError
,
"Must specify a root ('/') database"
if
DB
.
getActivityMonitor
()
is
None
:
if
DB
.
getActivityMonitor
()
is
None
:
from
ZODB.ActivityMonitor
import
ActivityMonitor
from
ZODB.ActivityMonitor
import
ActivityMonitor
DB
.
setActivityMonitor
(
ActivityMonitor
())
DB
.
setActivityMonitor
(
ActivityMonitor
())
...
...
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