Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
0d28713d
Commit
0d28713d
authored
Oct 30, 2008
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated DemoStorage ZConfig support.
parent
f68514a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
10 deletions
+60
-10
src/ZODB/DemoStorage.test
src/ZODB/DemoStorage.test
+49
-0
src/ZODB/component.xml
src/ZODB/component.xml
+1
-2
src/ZODB/config.py
src/ZODB/config.py
+10
-8
No files found.
src/ZODB/DemoStorage.test
View file @
0d28713d
...
...
@@ -278,3 +278,52 @@ storage wrapped around it when necessary:
>>>
import
os
>>>
os
.
path
.
exists
(
blobdir
)
False
ZConfig
support
===============
You
can
configure
demo
storages
using
ZConfig
,
using
name
,
changes
,
and
base
options
:
>>>
import
ZODB
.
config
>>>
storage
=
ZODB
.
config
.
storageFromString
(
"""
... <demostorage>
... </demostorage>
... """
)
>>>
storage
.
getName
()
"DemoStorage('MappingStorage', 'MappingStorage')"
>>>
storage
=
ZODB
.
config
.
storageFromString
(
"""
... <demostorage>
... <filestorage base>
... path base.fs
... </filestorage>
...
... <filestorage changes>
... path changes.fs
... </filestorage>
... </demostorage>
... """
)
>>>
storage
.
getName
()
"DemoStorage('base.fs', 'changes.fs')"
>>>
storage
.
close
()
>>>
storage
=
ZODB
.
config
.
storageFromString
(
"""
... <demostorage>
... name bob
... <filestorage>
... path base.fs
... </filestorage>
...
... <filestorage changes>
... path changes.fs
... </filestorage>
... </demostorage>
... """
)
>>>
storage
.
getName
()
'bob'
>>>
storage
.
base
.
getName
()
'base.fs'
>>>
storage
.
close
()
src/ZODB/component.xml
View file @
0d28713d
...
...
@@ -175,8 +175,7 @@
<sectiontype
name=
"demostorage"
datatype=
".DemoStorage"
implements=
"ZODB.storage"
>
<key
name=
"name"
/>
<section
type=
"ZODB.storage"
name=
"*"
attribute=
"base"
/>
<section
type=
"ZODB.storage"
name=
"changes"
attribute=
"changes"
/>
<multisection
type=
"ZODB.storage"
name=
"*"
attribute=
"factories"
/>
</sectiontype>
...
...
src/ZODB/config.py
View file @
0d28713d
...
...
@@ -120,15 +120,17 @@ class MappingStorage(BaseConfig):
class
DemoStorage
(
BaseConfig
):
def
open
(
self
):
base
=
changes
=
None
for
factory
in
self
.
config
.
factories
:
if
factory
.
name
==
'changes'
:
changes
=
factory
.
open
()
else
:
if
base
is
None
:
base
=
factory
.
open
()
else
:
raise
ValueError
(
"Too many base storages defined!"
)
from
ZODB.DemoStorage
import
DemoStorage
if
self
.
config
.
base
:
base
=
self
.
config
.
base
.
open
()
else
:
base
=
None
if
self
.
config
.
changes
:
changes
=
self
.
config
.
changes
.
open
()
else
:
changes
=
None
return
DemoStorage
(
self
.
config
.
name
,
base
=
base
,
changes
=
changes
)
class
FileStorage
(
BaseConfig
):
...
...
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