Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
091ed249
Commit
091ed249
authored
Apr 26, 2008
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed even more long deprecated stuff
parent
688dde26
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
240 deletions
+0
-240
lib/python/Products/Five/bbb.py
lib/python/Products/Five/bbb.py
+0
-50
lib/python/Products/Five/browser/configure.zcml
lib/python/Products/Five/browser/configure.zcml
+0
-13
lib/python/Products/Five/browser/tests/pages.txt
lib/python/Products/Five/browser/tests/pages.txt
+0
-7
lib/python/Products/Five/interfaces.py
lib/python/Products/Five/interfaces.py
+0
-10
lib/python/Products/Five/tests/test_viewable.py
lib/python/Products/Five/tests/test_viewable.py
+0
-97
lib/python/Products/Five/traversable.py
lib/python/Products/Five/traversable.py
+0
-31
lib/python/Products/Five/traversing.zcml
lib/python/Products/Five/traversing.zcml
+0
-7
lib/python/Products/Five/viewable.py
lib/python/Products/Five/viewable.py
+0
-25
No files found.
lib/python/Products/Five/bbb.py
View file @
091ed249
...
...
@@ -15,9 +15,6 @@
$Id$
"""
from
zope.interface
import
Interface
,
implements
from
zope.component.interfaces
import
ComponentLookupError
from
zope.app.publisher.browser
import
getDefaultViewName
import
Acquisition
...
...
@@ -43,50 +40,3 @@ class AcquisitionBBB(object):
def
aq_inContextOf
(
self
,
*
args
,
**
kw
):
return
Acquisition
.
aq_inContextOf
(
self
,
*
args
,
**
kw
)
class
IBrowserDefault
(
Interface
):
"""Provide a hook for deciding about the default view for an object"""
def
defaultView
(
self
,
request
):
"""Return the object to be published
(usually self) and a sequence of names to traverse to
find the method to be published.
"""
class
BrowserDefault
(
object
):
implements
(
IBrowserDefault
)
def
__init__
(
self
,
context
):
self
.
context
=
context
def
defaultView
(
self
,
request
):
context
=
self
.
context
try
:
name
=
getDefaultViewName
(
context
,
request
)
return
context
,
[
name
,]
except
ComponentLookupError
:
return
context
,
None
class
Traversable
:
"""A mixin to make an object traversable"""
__five_traversable__
=
True
def
__bobo_traverse__
(
self
,
REQUEST
,
name
):
"""Hook for Zope 2 traversal
This method is called by Zope 2's ZPublisher upon traversal.
It allows us to trick it into faking the Zope 3 traversal system
by using an ITraverser adapter.
"""
try
:
return
getattr
(
self
,
name
)
except
AttributeError
:
pass
try
:
return
self
[
name
]
except
(
KeyError
,
IndexError
,
TypeError
,
AttributeError
):
pass
raise
AttributeError
(
name
)
lib/python/Products/Five/browser/configure.zcml
View file @
091ed249
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
<!-- BBB 2006/05/01 - to be removed after 12 months -->
<browser:defaultView
for="Products.Five.bbb.IBrowserDefault"
name="index.html"
/>
<interface
interface="zope.publisher.interfaces.browser.IBrowserSkinType"
/>
...
...
@@ -15,13 +9,6 @@
interface="zope.app.publisher.interfaces.browser.IMenuItemType"
/>
<!-- BBB 2006/02/18, to be removed after 12 months -->
<browser:layer
name="default"
interface="zope.publisher.interfaces.browser.IDefaultBrowserLayer"
bbb_aware="true"
/>
<browser:page
for="*"
name="absolute_url"
...
...
lib/python/Products/Five/browser/tests/pages.txt
View file @
091ed249
...
...
@@ -113,13 +113,6 @@ Test macro access from ZPT pages:
>>> view()
u'<html><head><title>bird macro</title></head><body>Color: gray</body></html>\n'
Test whether old-style direct traversal still works with a
five:traversable class:
>>> old_view = self.folder.unrestrictedTraverse('testoid/direct')
>>> old_view()
'Direct traversal worked'
test_zpt_things:
>>> view = self.folder.unrestrictedTraverse('testoid/condor.html')
...
...
lib/python/Products/Five/interfaces.py
View file @
091ed249
...
...
@@ -23,13 +23,3 @@ class IMenuItemType(IInterface):
Menu item types are interfaces that define classes of
menu items.
"""
# BBB 2006/05/01 -- to be removed after 12 months
import
zope.deferredimport
zope
.
deferredimport
.
deprecated
(
"To get the default browser view of an object, use "
"zope.app.publisher.browser.queryDefaultViewName. To "
"define the default view of an object, use the "
"browser:defaultView directive"
,
IBrowserDefault
=
"Products.Five.bbb:IBrowserDefault"
,
)
lib/python/Products/Five/tests/test_viewable.py
deleted
100644 → 0
View file @
688dde26
##############################################################################
#
# Copyright (c) 2004, 2005 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.
#
##############################################################################
"""Unit tests for the viewable module.
$Id$
"""
import
os
,
sys
if
__name__
==
'__main__'
:
execfile
(
os
.
path
.
join
(
sys
.
path
[
0
],
'framework.py'
))
def
test_defaultView
():
"""
This tests the default view functionality. It also tests the deprecated
BrowserDefault class. References to BrowserDefault can be removed in 2.12.
Take a class Foo and an interface IFoo:
>>> class Foo:
... pass
>>> from zope.interface import Interface
>>> class IFoo(Interface):
... pass
Set up a default view for IFoo:
>>> from zope.component import provideAdapter
>>> from zope.component.interfaces import IDefaultViewName
>>> from zope.publisher.interfaces.browser import IBrowserRequest
and default view names for everything and IFoo objects in particular:
>>> from Products.Five.bbb import BrowserDefault, IBrowserDefault
>>> from zope.interface import Interface
>>> provideAdapter(BrowserDefault, (Interface,), IBrowserDefault)
>>> provideAdapter(u'index.html', (None, IBrowserRequest), IDefaultViewName)
>>> provideAdapter(u'foo.html', (IFoo, IBrowserRequest), IDefaultViewName)
Now take a BrowserDefault for an instance of Foo::
>>> foo = Foo()
>>> bd = BrowserDefault(foo)
For now the default view name is index.html, like we set above:
>>> from zope.publisher.browser import TestRequest
>>> request = TestRequest()
>>> from zope.app.publisher.browser import queryDefaultViewName
>>> queryDefaultViewName(foo, request)
u'index.html'
>>> obj, path = bd.defaultView(request)
>>> obj is foo
True
>>> path
[u'index.html']
until we mark the object with IFoo:
>>> from zope.interface import directlyProvides
>>> directlyProvides(foo, IFoo)
>>> queryDefaultViewName(foo, request)
u'foo.html'
>>> obj, path = bd.defaultView(request)
>>> obj is foo
True
>>> path
[u'foo.html']
Clean up adapter registry:
>>> from zope.testing.cleanup import cleanUp
>>> cleanUp()
"""
def
test_suite
():
import
unittest
from
zope.testing.doctest
import
DocTestSuite
from
Testing.ZopeTestCase
import
FunctionalDocFileSuite
return
unittest
.
TestSuite
((
DocTestSuite
(),
))
if
__name__
==
'__main__'
:
framework
()
lib/python/Products/Five/traversable.py
deleted
100644 → 0
View file @
688dde26
##############################################################################
#
# Copyright (c) 2004, 2005 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.
#
##############################################################################
"""Machinery for making things traversable through adaptation
BBB 2006/05/01 -- to be removed after 12 months
$Id$
"""
import
zope.deferredimport
zope
.
deferredimport
.
deprecated
(
"__bobo_traverse__ and ITraverser/ITraversable for controlling "
"URL traversal have become obsolete. Use an IPublishTraverse "
"adapter instead. This reference will go away in Zope 2.12."
,
Traversable
=
"Products.Five.bbb:Traversable"
,
FiveTraversable
=
"zope.traversing.adapters:DefaultTraversable"
,
)
zope
.
deferredimport
.
deprecated
(
"Use zope.publisher.browser.TestRequest instead."
,
FakeRequest
=
"zope.publisher.browser:TestRequest"
,
)
lib/python/Products/Five/traversing.zcml
View file @
091ed249
...
...
@@ -4,11 +4,4 @@
<!-- define default namespace adapters, etc. -->
<include package="zope.traversing" />
<!-- BBB 2006/05/01 - to be removed after 12 months -->
<adapter
for="*"
factory=".bbb.BrowserDefault"
provides=".bbb.IBrowserDefault"
/>
</configure>
lib/python/Products/Five/viewable.py
deleted
100644 → 0
View file @
688dde26
##############################################################################
#
# Copyright (c) 2004, 2005 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.
#
##############################################################################
"""Machinery for making things viewable
BBB 2006/05/01 -- to be removed after 12 months
$Id$
"""
import
zope.deferredimport
zope
.
deferredimport
.
deprecated
(
"To get the default browser view of an object, use "
"zope.app.publisher.browser.queryDefaultViewName."
,
BrowserDefault
=
"Products.Five.bbb:BrowserDefault"
,
)
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