Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Refactor (to simplify code) based on review.
Browse files Browse the repository at this point in the history
- Also use "public" attribute for accessing storage.
  • Loading branch information
Satchit Haridas committed Mar 6, 2013
1 parent b99773e commit 5a19082
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/zc/zodbwsgi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,12 @@ def __init__(self,
header = (demostorage_manage_header or
default.get('demostorage_manage_header'))
if header is not None:
if [1
for d in self.database.databases.values()
if not isinstance(d._storage, ZODB.DemoStorage.DemoStorage)
]:
raise UserError(
"Attempting to activate demostorage hooks when "
"one of the storages is not a DemoStorage")
else:
self.demostorage_manage_header = header.replace('-', '_')
else:
self.demostorage_manage_header = None
for d in self.database.databases.values():
if not isinstance(d.storage, ZODB.DemoStorage.DemoStorage):
raise UserError(
"Attempting to activate demostorage hooks when "
"one of the storages is not a DemoStorage")
self.demostorage_manage_header = header and header.replace('-', '_')

def __call__(self, environ, start_response):
if self.demostorage_manage_header is not None:
Expand Down

0 comments on commit 5a19082

Please sign in to comment.