Skip to content

Commit

Permalink
restore origiinal __repr__ (see plone/Products.CMFPlone#2590)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbauer committed Oct 26, 2018
1 parent f0f3558 commit 67d280d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
4 changes: 3 additions & 1 deletion Products/Archetypes/BaseContent.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from App.class_init import InitializeClass
from Products.CMFCore import permissions
from Products.CMFCore.PortalContent import PortalContent
from OFS.SimpleItem import PathReprProvider
from OFS.PropertyManager import PropertyManager

from zope.interface import implementer
Expand All @@ -22,7 +23,8 @@


@implementer(IBaseContent, IReferenceable)
class BaseContentMixin(CatalogMultiplex,
class BaseContentMixin(PathReprProvider,
CatalogMultiplex,
BaseObject,
PortalContent):
"""A not-so-basic CMF Content implementation that doesn't
Expand Down
4 changes: 2 additions & 2 deletions Products/Archetypes/Field.py
Original file line number Diff line number Diff line change
Expand Up @@ -2023,8 +2023,8 @@ def set(self, instance, value, **kwargs):
>>> _ = folder.invokeFactory('SimpleBTreeFolder', 'btf')
>>> nodes[2].setLink(folder.btf)
>>> nodes[2].getLink()
<SimpleBTreeFolder...>
>>> nodes[2].getLink().id
'btf'
"""
tool = getToolByName(instance, REFERENCE_CATALOG)
targetUIDs = [ref.targetUID for ref in
Expand Down
34 changes: 17 additions & 17 deletions Products/Archetypes/tests/events.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ will fire the modified event:
<Products.Archetypes.event.ObjectInitializedEvent object at ...>)]


Setup Content Type Registry so that a 'DDocument' is created:

>>> contents = StringIO('some contents')
>>> request = aputrequest(contents, 'text/plain')
>>> request.processInputs()
>>> ignore = d.PUT(request, request.RESPONSE)
>>> from Products.CMFCore.utils import getToolByName
>>> ctr = getToolByName(portal, 'content_type_registry')
>>> p_id = 'at_dav_test'
>>> p_type = 'name_regex'
>>> ctr.addPredicate(p_id, p_type)
>>> class foo: pass
>>> p_dict = foo()
>>> p_dict.pattern = '.*'
>>> ctr.updatePredicate(p_id, p_dict, 'DDocument')
Setup Content Type Registry so that a 'DDocument' is created:

>>> contents = StringIO('some contents')
>>> request = aputrequest(contents, 'text/plain')
>>> request.processInputs()
>>> ignore = d.PUT(request, request.RESPONSE)
>>> from Products.CMFCore.utils import getToolByName
>>> ctr = getToolByName(portal, 'content_type_registry')
>>> p_id = 'at_dav_test'
>>> p_type = 'name_regex'
>>> ctr.addPredicate(p_id, p_type)
>>> class foo: pass
>>> p_dict = foo()
>>> p_dict.pattern = '.*'
>>> ctr.updatePredicate(p_id, p_dict, 'DDocument')
>>> ctr.reorderPredicate(p_id, 0)

Doing a `PUT` request that creates a brand new object should fire
Expand All @@ -90,7 +90,7 @@ IWebDAVObjectInitializedEvent:
False

>>> from Testing.ZopeTestCase.zopedoctest.functional import http
>>> from Testing.ZopeTestCase.sandbox import AppZapper
>>> from Testing.ZopeTestCase.sandbox import AppZapper
>>> AppZapper().set(layer['app'])
>>> print http(r"""
... PUT /%s/some-document HTTP/1.1
Expand Down Expand Up @@ -134,7 +134,7 @@ IWebDAVObjectEditedEvent:
[(<DDocument at /plone/Members/test_user_1_/some-document>,
<Products.Archetypes.event.WebDAVObjectEditedEvent object at ...>)]

Finally, cleanup the CTR predicate to not affect other tests:
Finally, cleanup the CTR predicate to not affect other tests:

>>> ctr.removePredicate(p_id)

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
'ExtensionClass',
'transaction',
'ZODB3',
'Zope2 >= 2.13.1',
'Zope >= 4.0b7.dev0',
'Zope2',
'plone.app.widgets>=2.0.0.dev0'
],
)

0 comments on commit 67d280d

Please sign in to comment.