Skip to content

Commit

Permalink
Adjust zope.app to the new import location of zope.app.location.
Browse files Browse the repository at this point in the history
  • Loading branch information
philikon committed Apr 5, 2006
1 parent 759e002 commit ac4b3d6
Show file tree
Hide file tree
Showing 5 changed files with 568 additions and 2 deletions.
2 changes: 1 addition & 1 deletion browser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from zope.publisher.browser import BrowserLanguages
from zope.i18n.interfaces import IUserPreferredLanguages
from zope.i18n.interfaces import IModifiableUserPreferredLanguages
from zope.location import Location

from zope.app.location import Location
from zope.app.publisher.interfaces.browser import IBrowserView

key = "zope.app.publisher.browser.IUserPreferredLanguages"
Expand Down
2 changes: 1 addition & 1 deletion browser/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from zope.component.interfaces import IResource
from zope.interface import implements
from zope.traversing.browser.interfaces import IAbsoluteURL
from zope.location import Location

from zope.app.component.hooks import getSite
from zope.app.location import Location

class Resource(Location):
implements(IResource)
Expand Down
52 changes: 52 additions & 0 deletions browser/resources.py
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 ''
Loading

0 comments on commit ac4b3d6

Please sign in to comment.