diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-07-04 17:50:59 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-07-04 17:50:59 +0000 |
| commit | 8b2c67309a9a3f9cf709bf3003dc3275f17c709e (patch) | |
| tree | 1b20d5b000e4333cf50b2c2305dbb03e8b312144 /repoze/bfg/zodb.py | |
| parent | d6cb3c1b68e752922a149d37a8d208b7d01dbe14 (diff) | |
| download | pyramid-8b2c67309a9a3f9cf709bf3003dc3275f17c709e.tar.gz pyramid-8b2c67309a9a3f9cf709bf3003dc3275f17c709e.tar.bz2 pyramid-8b2c67309a9a3f9cf709bf3003dc3275f17c709e.zip | |
Don't depend on ZODB; shuffle policy responsibilities around a little.
Diffstat (limited to 'repoze/bfg/zodb.py')
| -rw-r--r-- | repoze/bfg/zodb.py | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/repoze/bfg/zodb.py b/repoze/bfg/zodb.py deleted file mode 100644 index c13d5fc58..000000000 --- a/repoze/bfg/zodb.py +++ /dev/null @@ -1,39 +0,0 @@ -from zope.interface import implements - -from repoze.zodbconn.middleware import get_conn - -from repoze.bfg.interfaces import IPolicy - -class ZODBGetitemPolicy: - - implements(IPolicy) - - def __init__(self, dbname, prefix=()): - self.dbname = dbname - self.prefix = prefix - self.get_conn = get_conn - - def __call__(self, environ): - conn = self.get_conn(environ, self.dbname) - if conn is None: - raise ValueError('No such connection %s' % self.dbname) - - path = environ['PATH_INFO'].split('/') - path = list(self.prefix) + path - - ob = conn.open() - - name = '' - while path: - element = path.pop(0) - try: - ob = ob[element] - except AttributeError, what: - raise AttributeError(str(what[0]) + ' (element: '+element+')') - except KeyError: - if path: - name = path.pop(0) - break - - return ob, name, path - |
