Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
Nicolas Wavrant
ZODB
Commits
c61b5eaa
Commit
c61b5eaa
authored
Sep 07, 2016
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added docstrings for items called by applications
parent
d67732a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
src/ZODB/config.py
src/ZODB/config.py
+27
-0
No files found.
src/ZODB/config.py
View file @
c61b5eaa
...
...
@@ -42,13 +42,33 @@ def getStorageSchema():
return
_s_schema
def
databaseFromString
(
s
):
"""Create a database from a database-configuration string.
The string must contain one or more :ref:`zodb
<database-text-configuration>` sections.
The database defined by the first section is returned.
If :ref:`more than one zodb section is provided
<multidatabase-text-configuration>`, a multi-database
configuration will be created and all of the databases will be
available in the returned database's ``databases`` attribute.
"""
return
databaseFromFile
(
StringIO
(
s
))
def
databaseFromFile
(
f
):
"""Create a database from a file object that provides configuration.
See :func:`databaseFromString`.
"""
config
,
handle
=
ZConfig
.
loadConfigFile
(
getDbSchema
(),
f
)
return
databaseFromConfig
(
config
.
database
)
def
databaseFromURL
(
url
):
"""Load a database from URL (or file name) that provides configuration.
See :func:`databaseFromString`.
"""
config
,
handler
=
ZConfig
.
loadConfig
(
getDbSchema
(),
url
)
return
databaseFromConfig
(
config
.
database
)
...
...
@@ -63,13 +83,20 @@ def databaseFromConfig(database_factories):
return
first
def
storageFromString
(
s
):
"""Create a storage from a storage-configuration string.
"""
return
storageFromFile
(
StringIO
(
s
))
def
storageFromFile
(
f
):
"""Create a storage from a file object providing storage-configuration.
"""
config
,
handle
=
ZConfig
.
loadConfigFile
(
getStorageSchema
(),
f
)
return
storageFromConfig
(
config
.
storage
)
def
storageFromURL
(
url
):
"""
\
Create a storage from a URL (or file name) providing storage-configuration.
"""
config
,
handler
=
ZConfig
.
loadConfig
(
getStorageSchema
(),
url
)
return
storageFromConfig
(
config
.
storage
)
...
...
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