Skip to content

Commit

Permalink
[fc] Repository: plone.app.layout
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2018-06-17T08:25:06+02:00
Author: Tom Gross (tomgross) <[email protected]>
Commit: plone/plone.app.layout@2237048

Helper  returns site, if context is not in aquisition chain (plone/Products.CMFPlone#2446) (#153)

Files changed:
M CHANGES.rst
M plone/app/layout/navigation/root.py
  • Loading branch information
pbauer committed Jun 17, 2018
1 parent 95e48d0 commit 97489e7
Showing 1 changed file with 37 additions and 93 deletions.
130 changes: 37 additions & 93 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,112 +1,56 @@
Repository: plone.app.content
Repository: plone.app.layout


Branch: refs/heads/master
Date: 2018-06-17T04:40:47+10:00
Date: 2018-06-17T08:25:06+02:00
Author: Tom Gross (tomgross) <[email protected]>
Commit: https://github.com/plone/plone.app.content/commit/e2e156d156de268f86516a3b80223d9f0bc11967
Commit: https://github.com/plone/plone.app.layout/commit/2237048b8f12a116a5cfb67490a1e0a0b728b5e8

Allow vocabulary to be called in subforms https://github.com/plone/Products.CMFPlone/issues/2446
Helper returns site, if context is not in aquisition chain (https://github.com/plone/Products.CMFPlone/issues/2446) (#153)

Files changed:
M CHANGES.rst
M plone/app/content/browser/vocabulary.py
M plone/app/layout/navigation/root.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 1a02e9e..f27d206 100644
index f123188..8c91b26 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -17,6 +17,9 @@ Bug fixes:
- Python 3 fixes.
[pbauer]
@@ -15,7 +15,9 @@ New features:

+- Allow `getSources` vocabulary view to be called in subforms
+ [tomgross]
+
3.5.2 (2018-04-08)
------------------

diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py
index 27c8da0..8f7955a 100644
--- a/plone/app/content/browser/vocabulary.py
+++ b/plone/app/content/browser/vocabulary.py
@@ -16,6 +16,7 @@
from Products.Five import BrowserView
from Products.MimetypesRegistry.MimeTypeItem import guess_icon_path
from types import FunctionType
+from z3c.form.interfaces import ISubForm
from zope.component import getUtility
from zope.component import queryAdapter
from zope.component import queryUtility
@@ -355,7 +356,11 @@ class SourceView(BaseVocabularyView):
"""Queries a field's source and returns JSON-formatted results."""

def get_context(self):
- return self.context.context
+ if ISubForm.providedBy(self.context.form):
+ context = self.context.form.parentForm.context
+ else:
+ context = self.context.context
+ return context

def get_vocabulary(self):
widget = self.context


Repository: plone.app.content


Branch: refs/heads/master
Date: 2018-06-17T08:23:43+02:00
Author: Philip Bauer (pbauer) <[email protected]>
Commit: https://github.com/plone/plone.app.content/commit/9337a28197d4dcf4efd0d94e8a8c2bb68ce3a911

Merge pull request #157 from plone/tg_subforms

Allow vocabulary to be called in subforms

Files changed:
M CHANGES.rst
M plone/app/content/browser/vocabulary.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 1a02e9e..f27d206 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -17,6 +17,9 @@ Bug fixes:
- Python 3 fixes.
[pbauer]
Bug fixes:

+- Allow `getSources` vocabulary view to be called in subforms
-- *add item here*
+- Helper `getNavigationRoot` returns site, if context is not in
+ acquisition chain (eg AJAX calls)
+ [tomgross]
+
3.5.2 (2018-04-08)
------------------

diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py
index 27c8da0..8f7955a 100644
--- a/plone/app/content/browser/vocabulary.py
+++ b/plone/app/content/browser/vocabulary.py
@@ -16,6 +16,7 @@
from Products.Five import BrowserView
from Products.MimetypesRegistry.MimeTypeItem import guess_icon_path
from types import FunctionType
+from z3c.form.interfaces import ISubForm
from zope.component import getUtility
from zope.component import queryAdapter
from zope.component import queryUtility
@@ -355,7 +356,11 @@ class SourceView(BaseVocabularyView):
"""Queries a field's source and returns JSON-formatted results."""

def get_context(self):
- return self.context.context
+ if ISubForm.providedBy(self.context.form):
+ context = self.context.form.parentForm.context
+ else:
+ context = self.context.context
+ return context

def get_vocabulary(self):
widget = self.context
2.8.0 (2018-04-24)
diff --git a/plone/app/layout/navigation/root.py b/plone/app/layout/navigation/root.py
index df1ab9d..fcc3d10 100644
--- a/plone/app/layout/navigation/root.py
+++ b/plone/app/layout/navigation/root.py
@@ -6,6 +6,7 @@
from plone.registry.interfaces import IRegistry
from Products.CMFCore.utils import getToolByName
from zope.component import getUtility
+from zope.component.hooks import getSite


def getNavigationRoot(context, relativeRoot=None):
@@ -25,7 +26,11 @@ def getNavigationRoot(context, relativeRoot=None):
through parents, looking for an object implementing INavigationRoot.
Return the path of that root.
"""
- portal_url = getToolByName(context, 'portal_url')
+ try:
+ portal_url = getToolByName(context, 'portal_url')
+ except AttributeError:
+ site = getSite()
+ return '/'.join(site.getPhysicalPath())

if relativeRoot is None:
# fetch from portal_properties


0 comments on commit 97489e7

Please sign in to comment.