-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust zope.app to the new import location of zope.app.location.
- Loading branch information
Showing
5 changed files
with
568 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2002 Zope Corporation and Contributors. | ||
# All Rights Reserved. | ||
# | ||
# This software is subject to the provisions of the Zope Public License, | ||
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | ||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | ||
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | ||
# FOR A PARTICULAR PURPOSE. | ||
# | ||
############################################################################## | ||
"""Resource URL acess | ||
$Id$ | ||
""" | ||
import zope.component | ||
from zope.publisher.interfaces.browser import IBrowserPublisher | ||
from zope.publisher.interfaces import NotFound | ||
from zope.interface import implements | ||
from zope.location import locate | ||
|
||
from zope.app.publisher.browser import BrowserView | ||
|
||
class Resources(BrowserView): | ||
"""Provide a URL-accessible resource namespace | ||
""" | ||
|
||
implements(IBrowserPublisher) | ||
|
||
def publishTraverse(self, request, name): | ||
'''See interface IBrowserPublisher''' | ||
|
||
resource = zope.component.queryAdapter(request, name=name) | ||
if resource is None: | ||
raise NotFound(self, name) | ||
|
||
sm = zope.component.getSiteManager() | ||
locate(resource, sm, name) | ||
return resource | ||
|
||
def browserDefault(self, request): | ||
'''See IBrowserPublisher''' | ||
return empty, () | ||
|
||
def __getitem__(self, name): | ||
return self.publishTraverse(self.request, name) | ||
|
||
|
||
def empty(): | ||
return '' |
Oops, something went wrong.