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
7fa6b98a
Commit
7fa6b98a
authored
Mar 30, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More Five avoidance
parent
b96b2151
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
30 deletions
+35
-30
src/OFS/ObjectManager.py
src/OFS/ObjectManager.py
+0
-3
src/OFS/event.txt
src/OFS/event.txt
+1
-2
src/OFS/metaconfigure.py
src/OFS/metaconfigure.py
+1
-1
src/OFS/tests/testObjectManager.py
src/OFS/tests/testObjectManager.py
+8
-4
src/OFS/tests/testTraverse.py
src/OFS/tests/testTraverse.py
+6
-8
src/OFS/tests/test_event.py
src/OFS/tests/test_event.py
+1
-1
src/OFS/tests/test_registerclass.py
src/OFS/tests/test_registerclass.py
+2
-2
src/ZPublisher/tests/testHTTPRequest.py
src/ZPublisher/tests/testHTTPRequest.py
+16
-9
No files found.
src/OFS/ObjectManager.py
View file @
7fa6b98a
...
...
@@ -152,9 +152,6 @@ class ObjectManager(CopyContainer,
This class provides core behavior for collections of heterogeneous objects.
"""
# The claim to implement IContainer has been made during the Zope3
# integration project called Five but hasn't been completed in full.
implements
(
IObjectManager
)
security
=
ClassSecurityInfo
()
...
...
src/OFS/event.txt
View file @
7fa6b98a
...
...
@@ -183,8 +183,7 @@ subscribe to them.
so it doesn't have a location.
There are only a few basic use cases about what one wants to do with
respect to events (but you might want to read the full story in
Five/tests/event.txt).
respect to events.
The first use case is the one where the object has to be aware of its
path, like in the CoolDocument example above.
...
...
src/OFS/metaconfigure.py
View file @
7fa6b98a
...
...
@@ -117,7 +117,7 @@ def _registerClass(class_, meta_type, permission, addview, icon, global_):
info
=
{
'name'
:
meta_type
,
'action'
:
addview
and
(
'+/%s'
%
addview
)
or
''
,
'product'
:
'
Five
'
,
'product'
:
'
OFS
'
,
'permission'
:
str
(
permission_obj
.
title
),
'visibility'
:
global_
and
'Global'
or
None
,
'interfaces'
:
interfaces
,
...
...
src/OFS/tests/testObjectManager.py
View file @
7fa6b98a
import
unittest
from
zope.component.testing
import
PlacelessSetup
from
zope.interface
import
implements
from
AccessControl.Owned
import
EmergencyUserCannotOwn
from
AccessControl.SecurityManagement
import
newSecurityManager
...
...
@@ -11,13 +12,14 @@ from Acquisition import aq_base
from
Acquisition
import
Implicit
from
App.config
import
getConfiguration
from
logging
import
getLogger
from
OFS.interfaces
import
IItem
from
OFS.metaconfigure
import
setDeprecatedManageAddDelete
from
OFS.ObjectManager
import
ObjectManager
from
OFS.SimpleItem
import
SimpleItem
from
Zope2.App
import
zcml
from
zExceptions
import
BadRequest
logger
=
getLogger
(
'OFS.subscribers'
)
logger
=
getLogger
(
'OFS.subscribers'
)
class
FauxRoot
(
Implicit
):
...
...
@@ -61,12 +63,12 @@ class ItemForDeletion(SimpleItem):
def
manage_afterClone
(
self
,
item
):
pass
from
zope.interface
import
implements
from
OFS.interfaces
import
IItem
class
ObjectManagerWithIItem
(
ObjectManager
):
"""The event subscribers work on IItem."""
implements
(
IItem
)
class
ObjectManagerTests
(
PlacelessSetup
,
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -92,11 +94,13 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
def
_makeOne
(
self
,
*
args
,
**
kw
):
return
self
.
_getTargetClass
()(
*
args
,
**
kw
).
__of__
(
FauxRoot
()
)
def
test_
z3
interfaces
(
self
):
def
test_interfaces
(
self
):
from
OFS.interfaces
import
IObjectManager
from
OFS.ObjectManager
import
ObjectManager
from
zope.container.interfaces
import
IContainer
from
zope.interface.verify
import
verifyClass
verifyClass
(
IContainer
,
ObjectManager
)
verifyClass
(
IObjectManager
,
ObjectManager
)
def
test_setObject_set_owner_with_no_user
(
self
):
...
...
src/OFS/tests/testTraverse.py
View file @
7fa6b98a
...
...
@@ -186,8 +186,7 @@ class TestTraverse( unittest.TestCase ):
class
BoboTraversableWithAcquisition
(
SimpleItem
):
""" A BoboTraversable which may use acquisition to find objects.
This is similar to how the __bobo_traverse__ added by Five
behaves).
This is similar to how the __bobo_traverse__ behaves).
"""
def
__bobo_traverse__
(
self
,
request
,
name
):
...
...
@@ -409,9 +408,8 @@ class SimpleClass(object):
def
test_traversable
():
"""
Test the behaviour of unrestrictedTraverse and views. The tests are
copies from Five.browser.tests.test_traversable, but instead of
publishing they do unrestrictedTraverse.
Test the behaviour of unrestrictedTraverse and views. The tests don't
use publishing but do unrestrictedTraverse instead.
>>> import Products.Five
>>> from Zope2.App import zcml
...
...
@@ -433,9 +431,9 @@ def test_traversable():
... self.folder.testoid.unrestrictedTraverse('doesntexist')
... except NotFound:
... pass
Now let's take class which already has a __bobo_traverse__ method.
Fiv
e should correctly use that as a fallback.
W
e should correctly use that as a fallback.
>>> configure_zcml = '''
... <configure xmlns="http://namespaces.zope.org/zope"
...
...
@@ -527,7 +525,7 @@ def test_traversable():
Without a __bobo_traverse__ method this would have returned the attribute
value 'This is an attribute'. Let's make sure the same thing happens for
an object that has been marked traversable
by Five
:
an object that has been marked traversable:
>>> self.folder.fancy.an_attribute = 'This is an attribute'
>>> self.folder.fancy.unrestrictedTraverse(
...
...
src/OFS/tests/test_event.py
View file @
7fa6b98a
...
...
@@ -11,7 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test events
triggered by Five
"""Test events
$Id$
"""
...
...
src/OFS/tests/test_registerclass.py
View file @
7fa6b98a
...
...
@@ -62,7 +62,7 @@ def test_registerClass():
... if info['name'] == 'Foo Type':
... break
>>> info['product']
'
Five
'
'
OFS
'
>>> info['permission']
'Add Foo'
>>> ISimpleContent in info['interfaces']
...
...
@@ -113,7 +113,7 @@ def test_registerClass():
... if info['name'] == 'Bar Type':
... break
>>> info['product']
'
Five
'
'
OFS
'
>>> info['permission']
'Add Bar'
>>> ISimpleContent in info['interfaces']
...
...
src/ZPublisher/tests/testHTTPRequest.py
View file @
7fa6b98a
...
...
@@ -604,19 +604,19 @@ class HTTPRequestTests(unittest.TestCase):
self
.
assertEquals
(
req
.
cookies
[
'hmm'
],
''
)
self
.
assertEquals
(
req
.
cookies
[
'baz'
],
'gee'
)
# Unquoted multi-space cookies
# Unquoted multi-space cookies
env
[
'HTTP_COOKIE'
]
=
'single=cookie data; '
\
'quoted="cookie data with unquoted spaces"; '
\
'multi=cookie data with unquoted spaces; '
\
'multi2=cookie data with unquoted spaces'
'quoted="cookie data with unquoted spaces"; '
\
'multi=cookie data with unquoted spaces; '
\
'multi2=cookie data with unquoted spaces'
req
=
self
.
_makeOne
(
environ
=
env
)
self
.
assertEquals
(
req
.
cookies
[
'single'
],
'cookie data'
)
self
.
assertEquals
(
req
.
cookies
[
'quoted'
],
'cookie data with unquoted spaces'
)
'cookie data with unquoted spaces'
)
self
.
assertEquals
(
req
.
cookies
[
'multi'
],
'cookie data with unquoted spaces'
)
'cookie data with unquoted spaces'
)
self
.
assertEquals
(
req
.
cookies
[
'multi2'
],
'cookie data with unquoted spaces'
)
'cookie data with unquoted spaces'
)
...
...
@@ -719,6 +719,14 @@ class HTTPRequestTests(unittest.TestCase):
request
[
'debug'
]
=
'2'
self
.
assertEqual
(
request
.
debug
,
'2'
)
def
test_interfaces
(
self
):
from
zope.publisher.interfaces.browser
import
IBrowserRequest
from
zope.interface.verify
import
verifyClass
klass
=
self
.
_getTargetClass
()
# TODO
# verifyClass(IBrowserRequest, klass)
def
test_locale_property_accessor
(
self
):
from
zope.component
import
provideAdapter
from
zope.publisher.browser
import
BrowserLanguages
...
...
@@ -751,7 +759,6 @@ class HTTPRequestTests(unittest.TestCase):
from
zope.publisher.browser
import
BrowserLanguages
from
zope.publisher.interfaces.http
import
IHTTPRequest
from
zope.i18n.interfaces
import
IUserPreferredLanguages
from
zope.i18n.interfaces.locales
import
ILocale
provideAdapter
(
BrowserLanguages
,
[
IHTTPRequest
],
IUserPreferredLanguages
)
...
...
@@ -844,7 +851,7 @@ class HTTPRequestTests(unittest.TestCase):
request
=
self
.
_makeOne
(
environ
=
env
)
self
.
assertEqual
(
request
.
method
,
'GET'
)
def
test_method_
GE
T
(
self
):
def
test_method_
POS
T
(
self
):
env
=
{
'REQUEST_METHOD'
:
'POST'
}
request
=
self
.
_makeOne
(
environ
=
env
)
self
.
assertEqual
(
request
.
method
,
'POST'
)
...
...
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