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
c4c1b4ac
Commit
c4c1b4ac
authored
Aug 14, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retire the manage_interfaces ZMI screens.
parent
4c668817
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
8 additions
and
262 deletions
+8
-262
src/OFS/SimpleItem.py
src/OFS/SimpleItem.py
+8
-10
src/OFS/tests/testFileAndImage.py
src/OFS/tests/testFileAndImage.py
+0
-8
src/Products/Five/utilities/browser/__init__.py
src/Products/Five/utilities/browser/__init__.py
+0
-0
src/Products/Five/utilities/browser/configure.zcml
src/Products/Five/utilities/browser/configure.zcml
+0
-20
src/Products/Five/utilities/browser/edit_markers.pt
src/Products/Five/utilities/browser/edit_markers.pt
+0
-63
src/Products/Five/utilities/browser/manage_interfaces.pt
src/Products/Five/utilities/browser/manage_interfaces.pt
+0
-7
src/Products/Five/utilities/browser/marker.py
src/Products/Five/utilities/browser/marker.py
+0
-61
src/Products/Five/utilities/browser/tests/__init__.py
src/Products/Five/utilities/browser/tests/__init__.py
+0
-0
src/Products/Five/utilities/browser/tests/test_marker.py
src/Products/Five/utilities/browser/tests/test_marker.py
+0
-91
src/Products/Five/utilities/configure.zcml
src/Products/Five/utilities/configure.zcml
+0
-2
No files found.
src/OFS/SimpleItem.py
View file @
c4c1b4ac
...
...
@@ -118,26 +118,24 @@ class Item(Base,
__name__
=
ComputedAttribute
(
lambda
self
:
self
.
id
)
# Meta type used for selecting all objects of a given type.
meta_type
=
'simple item'
meta_type
=
'simple item'
# Default title.
title
=
''
title
=
''
# Default propertysheet info:
__propsets__
=
()
__propsets__
=
()
manage_options
=
(
UndoSupport
.
manage_options
+
Owned
.
manage_options
+
({
'label'
:
'Interfaces'
,
'action'
:
'manage_interfaces'
},)
)
manage_options
=
(
UndoSupport
.
manage_options
+
Owned
.
manage_options
)
# Attributes that must be acquired
REQUEST
=
Acquired
# Allow (reluctantly) access to unprotected attributes
__allow_access_to_unprotected_subobjects__
=
1
__allow_access_to_unprotected_subobjects__
=
1
def
title_or_id
(
self
):
"""Return the title if it is not blank and the id otherwise.
...
...
src/OFS/tests/testFileAndImage.py
View file @
c4c1b4ac
...
...
@@ -302,14 +302,6 @@ class FileTests(unittest.TestCase):
'come to the aid of the Party.'
)
self
.
assertTrue
(
'Party'
in
self
.
file
.
PrincipiaSearchSource
())
def
testFindFile
(
self
):
self
.
file
.
manage_edit
(
'foobar'
,
'text/plain'
,
filedata
=
'Now is the time for all good men to '
'come to the aid of the Party.'
)
results
=
self
.
app
.
ZopeFind
(
self
.
app
,
obj_searchterm
=
'Party'
)
self
.
assertEqual
(
len
(
results
),
1
)
self
.
assertEqual
(
results
[
0
][
1
],
self
.
file
)
def
test_interfaces
(
self
):
from
zope.interface.verify
import
verifyClass
from
OFS.Image
import
File
...
...
src/Products/Five/utilities/browser/__init__.py
deleted
100644 → 0
View file @
4c668817
src/Products/Five/utilities/browser/configure.zcml
deleted
100644 → 0
View file @
4c668817
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
<browser:page
for="*"
name="edit-markers.html"
template="edit_markers.pt"
class="Products.Five.utilities.browser.marker.EditView"
permission="zope2.ManageProperties"
/>
<browser:page
for="*"
name="manage_interfaces"
template="manage_interfaces.pt"
class="Products.Five.utilities.browser.marker.EditView"
permission="zope2.ManageProperties"
/>
</configure>
src/Products/Five/utilities/browser/edit_markers.pt
deleted
100644 → 0
View file @
4c668817
<html
metal:use-macro=
"context/@@standard_macros/page"
>
<body>
<metal:slot
metal:fill-slot=
"body"
>
<metal:macro
metal:define-macro=
"heading"
>
<h1
i18n:translate=
"heading_edit_marker"
>
Assign Marker Interfaces
</h1>
</metal:macro>
<metal:macro
metal:define-macro=
"main"
>
<p
class=
"form-help formHelp"
i18n:translate=
""
>
Change the behavior of this
object by adding or removing marker interfaces. You can choose one or more
interfaces to be added to the list of provided interfaces for this
object.
</p>
<p
class=
"form-help formHelp"
i18n:translate=
""
>
A marker interface is used to
identify an instance of a piece of content. When in conjunction with Five,
this allows you to enable and disable views based on marker interfaces for
example.
</p>
<form
action=
"."
method=
"post"
tal:attributes=
"action request/ACTUAL_URL"
>
<fieldset>
<legend
i18n:translate=
"legend_provided"
>
Provided Interfaces
</legend>
<tal:loop
tal:repeat=
"interface view/getInterfaceNames"
>
<label
class=
"form-mono"
tal:content=
"interface/name"
>
INTERFACE
</label><br
/>
</tal:loop>
<tal:loop
tal:repeat=
"interface view/getDirectlyProvidedNames"
>
<input
type=
"checkbox"
id=
"INTERFACE"
name=
"remove:list"
tal:attributes=
"id interface/name; value interface/name"
/>
<label
class=
"form-mono"
for=
"INTERFACE"
tal:attributes=
"for interface/name"
tal:content=
"interface/name"
>
INTERFACE
</label><br
/>
</tal:loop>
<tal:case
tal:condition=
"view/getDirectlyProvidedNames"
>
<div
class=
"formControls FormButtons"
>
<input
class=
"form-element"
type=
"submit"
name=
"SAVE"
value=
"Remove"
i18n:attributes=
"value"
/>
</div>
</tal:case>
</fieldset>
<fieldset>
<legend
i18n:translate=
"legend_available_marker"
>
Available Marker
Interfaces
</legend>
<tal:loop
tal:repeat=
"interface view/getAvailableInterfaceNames"
>
<input
type=
"checkbox"
id=
"INTERFACE"
name=
"add:list"
tal:attributes=
"id interface/name; value interface/name"
/>
<label
class=
"form-mono"
for=
"INTERFACE"
tal:attributes=
"for interface/name"
tal:content=
"interface/name"
>
INTERFACE
</label><br
/>
</tal:loop>
<div
class=
"formControls FormButtons"
>
<input
class=
"form-element"
type=
"submit"
name=
"SAVE"
value=
"Add"
i18n:attributes=
"value"
/>
</div>
</fieldset>
</form>
</metal:macro>
</metal:slot>
</body>
</html>
src/Products/Five/utilities/browser/manage_interfaces.pt
deleted
100644 → 0
View file @
4c668817
<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
<h2 tal:replace="structure context/manage_tabs">TABS</h2>
<style type="text/css">
fieldset {width:auto; float:left}
</style>
<metal:macro metal:use-macro="context/@@edit-markers.html/main" />
<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>
src/Products/Five/utilities/browser/marker.py
deleted
100644 → 0
View file @
4c668817
##############################################################################
#
# Copyright (c) 2004, 2005 Zope Foundation 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.
#
##############################################################################
"""Marker interfaces adapter views.
"""
from
Products.Five.utilities.interfaces
import
IMarkerInterfaces
class
EditView
(
object
):
"""Marker interface edit view.
"""
def
__init__
(
self
,
context
,
request
):
self
.
context
=
context
self
.
request
=
request
self
.
adapted
=
IMarkerInterfaces
(
context
)
self
.
context_url
=
self
.
context
.
absolute_url
()
def
__call__
(
self
,
SAVE
=
None
,
add
=
(),
remove
=
()):
if
SAVE
:
self
.
update
(
add
,
remove
)
self
.
request
.
response
.
redirect
(
self
.
request
.
ACTUAL_URL
)
return
''
return
self
.
index
()
def
_getLinkToInterfaceDetailsView
(
self
,
interfaceName
):
return
(
self
.
context_url
+
(
'/views-details.html?iface=%s&type=zope.publisher.'
'interfaces.browser.IBrowserRequest'
%
interfaceName
))
def
_getNameLinkDicts
(
self
,
interfaceNames
):
return
[
dict
(
name
=
name
,
link
=
self
.
_getLinkToInterfaceDetailsView
(
name
))
for
name
in
interfaceNames
]
def
getAvailableInterfaceNames
(
self
):
return
self
.
_getNameLinkDicts
(
self
.
adapted
.
getAvailableInterfaceNames
())
def
getDirectlyProvidedNames
(
self
):
return
self
.
_getNameLinkDicts
(
self
.
adapted
.
getDirectlyProvidedNames
())
def
getInterfaceNames
(
self
):
return
self
.
_getNameLinkDicts
(
self
.
adapted
.
getInterfaceNames
())
def
update
(
self
,
add
,
remove
):
# this could return errors
add
=
self
.
adapted
.
dottedToInterfaces
(
add
)
remove
=
self
.
adapted
.
dottedToInterfaces
(
remove
)
self
.
adapted
.
update
(
add
=
add
,
remove
=
remove
)
src/Products/Five/utilities/browser/tests/__init__.py
deleted
100644 → 0
View file @
4c668817
src/Products/Five/utilities/browser/tests/test_marker.py
deleted
100644 → 0
View file @
4c668817
##############################################################################
#
# Copyright (c) 2004, 2005 Zope Foundation 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 marker interface views.
"""
def
test_editview
():
"""
Set everything up:
>>> from zope.component.testing import setUp, tearDown
>>> setUp()
>>> import AccessControl
>>> import Products.Five
>>> import Products.Five.utilities
>>> from Zope2.App import zcml
>>> zcml.load_config('meta.zcml', Products.Five)
>>> zcml.load_config('permissions.zcml', AccessControl)
>>> zcml.load_config('configure.zcml', Products.Five.utilities)
>>> from Products.Five.utilities.browser.marker import EditView
>>> from Products.Five.tests.testing.simplecontent import SimpleContent
>>> obj = SimpleContent('foo', 'Foo').__of__(self.folder)
Create an EditView:
>>> view = EditView(obj, {})
>>> view.context.aq_inner is obj
True
>>> view.request
{}
>>> view.getAvailableInterfaceNames()
[]
>>> view.getDirectlyProvidedNames()
[]
>>> view.getInterfaceNames()
[...ISimpleContent...]
Try to add a marker interface that doesn't exist:
>>> view.update(('__main__.IFooMarker',), ())
Traceback (most recent call last):
...
ComponentLookupError...
Now create the marker interface:
>>> from Products.Five.tests.testing.simplecontent import ISimpleContent
>>> class IFooMarker(ISimpleContent): pass
>>> from zope.component.interface import provideInterface
>>> provideInterface('', IFooMarker)
>>> view.getAvailableInterfaceNames()
[...IFooMarker...]
>>> view.getDirectlyProvidedNames()
[]
And try again to add it to the object:
>>> view.update(('__main__.IFooMarker',), ())
>>> view.getAvailableInterfaceNames()
[]
>>> view.getDirectlyProvidedNames()
[...IFooMarker...]
And remove it again:
>>> view.update((), ('__main__.IFooMarker',))
>>> view.getAvailableInterfaceNames()
[...IFooMarker...]
>>> view.getDirectlyProvidedNames()
[]
Finally tear down:
>>> tearDown()
"""
def
test_suite
():
from
Testing.ZopeTestCase
import
ZopeDocTestSuite
return
ZopeDocTestSuite
()
src/Products/Five/utilities/configure.zcml
View file @
c4c1b4ac
<configure xmlns="http://namespaces.zope.org/zope">
<include package=".browser"/>
<adapter
for="*"
provides=".interfaces.IMarkerInterfaces"
...
...
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