Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZO-4801: Fix saving audio reference on article #635

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/docs/changelog/ZO-4801.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ZO-4801: Fix saving audio reference on article
2 changes: 1 addition & 1 deletion core/src/zeit/cms/content/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __set__(self, instance, value):
else:
for node in self._reference_nodes(instance):
node.getparent().remove(node)
parent, name = create_parent_nodes(self.path, instance.xml)
parent, name = create_parent_nodes(self.path, xml)
for node in value:
node.tag = name
parent.append(node)
Expand Down
13 changes: 13 additions & 0 deletions core/src/zeit/cms/content/tests/test_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,19 @@ def test_works_with_security(self):
content.references = content.references.create(target)
self.assertEqual('http://xml.zeit.de/target', content.references.target.uniqueId)

def test_works_with_security_on_adapter(self):
target = zope.security.proxy.ProxyFactory(self.repository['target'])
with checked_out(self.repository['content']) as co:
content = zope.security.proxy.ProxyFactory(co)
# The IRelatedContent adapter is registered with trusted=true,
# but it's unclear whether this is the general contract for these:
# ReferenceProperty already does use removeSecurityProxy, and there
# also currently are some adapters that do not use trusted (e.g.
# z.c.audio). So we probably ought to support this case.
related = zeit.cms.related.related.RelatedContent(content)
related.related = (target,)
self.assertEqual('http://xml.zeit.de/target', related.related[0].uniqueId)


class MultiResourceTest(ReferenceFixture, zeit.cms.testing.ZeitCmsTestCase):
def setUp(self):
Expand Down
Loading