Skip to content

Commit

Permalink
[fc] Repository: plone.app.vocabularies
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2015-09-19T15:04:36+02:00
Author: esteele (esteele) <eric@esteele.net>
Commit: plone/plone.app.vocabularies@dd443d0

Pull default_charset from registry.

Files changed:
M CHANGES.rst
M plone/app/vocabularies/catalog.py
Repository: plone.app.vocabularies
Branch: refs/heads/master
Date: 2015-09-20T11:00:15+02:00
Author: esteele (esteele) <eric@esteele.net>
Commit: plone/plone.app.vocabularies@3c9b7ac

Failover if registry can't be found. Mainly for tests, because I don't want to figure out how to add a mock registry in a docstring doctest. Grr.

Files changed:
M plone/app/vocabularies/catalog.py
Repository: plone.app.vocabularies
Branch: refs/heads/master
Date: 2015-09-20T11:01:09+02:00
Author: esteele (esteele) <eric@esteele.net>
Commit: plone/plone.app.vocabularies@7bf7da9

Use utf-8 as fallback encoding, since that's what we use elsewhere in core.

Files changed:
M plone/app/vocabularies/catalog.py
Repository: plone.app.vocabularies
Branch: refs/heads/master
Date: 2015-09-20T12:22:19+02:00
Author: esteele (esteele) <eric@esteele.net>
Commit: plone/plone.app.vocabularies@5d75ed4

Default to utf8

Files changed:
M plone/app/vocabularies/catalog.py
Repository: plone.app.vocabularies
Branch: refs/heads/master
Date: 2015-09-20T17:33:05+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: plone/plone.app.vocabularies@19a981f

Merge pull request #22 from plone/portal-properties-cleanup

Portal properties cleanup

Files changed:
M CHANGES.rst
M plone/app/vocabularies/catalog.py
  • Loading branch information
pbauer committed Sep 20, 2015
1 parent cb2086f commit 972337e
Showing 1 changed file with 177 additions and 141 deletions.
318 changes: 177 additions & 141 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,200 +1,236 @@
Repository: plone.dexterity
Repository: plone.app.vocabularies


Branch: refs/heads/master
Date: 2015-09-20T17:31:25+02:00
Date: 2015-09-19T15:04:36+02:00
Author: esteele (esteele) <eric@esteele.net>
Commit: https://github.com/plone/plone.dexterity/commit/daa8d26f6af8e3e02ec5fdcc4506d0b5122d9b5b
Commit: https://github.com/plone/plone.app.vocabularies/commit/dd443d088e75563db1abd1029610bb9fcd32faec

Use registry lookup for types_use_view_action_in_listings
Pull default_charset from registry.

Files changed:
M CHANGES.rst
M plone/dexterity/browser/edit.py
M plone/app/vocabularies/catalog.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 69d0bad..06111a0 100644
index e6506cd..188b75b 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -5,6 +5,9 @@ Changelog
2.3.5 (unreleased)
------------------
@@ -4,8 +4,8 @@ Changelog
2.1.22 (unreleased)
-------------------

+- Use registry lookup for types_use_view_action_in_listings
-- Nothing changed yet.
-
+- Pull default_charset value from the configuration registry.
+ [esteele]
+
- Don't check type constraints in AddForm.update() if request provides
IDeferSecurityChecks.
[alecm]
diff --git a/plone/dexterity/browser/edit.py b/plone/dexterity/browser/edit.py
index f891d25..1eb4dce 100644
--- a/plone/dexterity/browser/edit.py
+++ b/plone/dexterity/browser/edit.py
@@ -8,6 +8,7 @@
from plone.dexterity.i18n import MessageFactory as _
from plone.dexterity.interfaces import IDexterityEditForm
from plone.dexterity.interfaces import IDexterityFTI

2.1.21 (2015-09-07)
-------------------
diff --git a/plone/app/vocabularies/catalog.py b/plone/app/vocabularies/catalog.py
index 42b9c0e..5411c30 100644
--- a/plone/app/vocabularies/catalog.py
+++ b/plone/app/vocabularies/catalog.py
@@ -3,12 +3,14 @@
from plone.app.querystring import queryparser
from plone.app.vocabularies import SlicableVocabulary
from plone.app.vocabularies.terms import BrowsableTerm
+from plone.registry.interfaces import IRegistry
from plone.z3cform import layout
from z3c.form import button
from z3c.form import form
@@ -43,21 +44,13 @@ def handleCancel(self, action):
from plone.uuid.interfaces import IUUID
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import safe_unicode
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.ZCTextIndex.ParseTree import ParseError
from zope.browser.interfaces import ITerms
+from zope.component import getUtility
from zope.formlib.interfaces import ISourceQueryView
from zope.interface import implementer
from zope.interface import provider
@@ -149,11 +151,8 @@ def __init__(self, context, base_query={}, default_query=None):
self.catalog = getToolByName(context, "portal_catalog")
self.portal_tool = getToolByName(context, "portal_url")
self.portal_path = self.portal_tool.getPortalPath()
- try:
- self.encoding = getToolByName(
- context, "portal_properties").site_properties.default_charset
- except AttributeError:
- self.encoding = 'ascii'
+ registry = getUtility(IRegistry)
+ self.encoding = registry.get('plone.default_charset', 'ascii')

def nextURL(self):
view_url = self.context.absolute_url()
- portal_properties = getToolByName(self, 'portal_properties', None)
- if portal_properties is not None:
- site_properties = getattr(
- portal_properties,
- 'site_properties',
- None
- )
- portal_type = self.portal_type
- if site_properties is not None and portal_type is not None:
- use_view_action = site_properties.getProperty(
- 'typesUseViewActionInListings',
- ()
- )
- if portal_type in use_view_action:
- view_url = view_url + '/view'
+ portal_type = self.portal_type
+ if portal_type is not None:
+ registry = getUtility(IRegistry)
+ use_view_action = registry.get(
+ 'plone.types_view_action_in_listings', [])
+ if portal_type in use_view_action:
+ view_url = view_url + '/view'
return view_url
def __contains__(self, value):
"""Return whether the value is available in this source


Repository: plone.app.vocabularies


Branch: refs/heads/master
Date: 2015-09-20T11:00:15+02:00
Author: esteele (esteele) <eric@esteele.net>
Commit: https://github.com/plone/plone.app.vocabularies/commit/3c9b7acf3979db8b4e1e17377ad4000cf60f19a9

Failover if registry can't be found. Mainly for tests, because I don't want to figure out how to add a mock registry in a docstring doctest. Grr.

Files changed:
M plone/app/vocabularies/catalog.py

diff --git a/plone/app/vocabularies/catalog.py b/plone/app/vocabularies/catalog.py
index 5411c30..1516b92 100644
--- a/plone/app/vocabularies/catalog.py
+++ b/plone/app/vocabularies/catalog.py
@@ -10,7 +10,7 @@
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.ZCTextIndex.ParseTree import ParseError
from zope.browser.interfaces import ITerms
-from zope.component import getUtility
+from zope.component import queryUtility
from zope.formlib.interfaces import ISourceQueryView
from zope.interface import implementer
from zope.interface import provider
@@ -151,8 +151,12 @@ def __init__(self, context, base_query={}, default_query=None):
self.catalog = getToolByName(context, "portal_catalog")
self.portal_tool = getToolByName(context, "portal_url")
self.portal_path = self.portal_tool.getPortalPath()
- registry = getUtility(IRegistry)
- self.encoding = registry.get('plone.default_charset', 'ascii')
+
+ registry = queryUtility(IRegistry)
+ if registry is not None:
+ self.encoding = registry.get('plone.default_charset', 'ascii')
+ else:
+ self.encoding = 'ascii'

def update(self):
def __contains__(self, value):
"""Return whether the value is available in this source


Repository: plone.dexterity
Repository: plone.app.vocabularies


Branch: refs/heads/master
Date: 2015-09-20T17:31:26+02:00
Date: 2015-09-20T11:01:09+02:00
Author: esteele (esteele) <eric@esteele.net>
Commit: https://github.com/plone/plone.dexterity/commit/c1129e93bcd3128ac9ee7c105f93f2bf7c11404f
Commit: https://github.com/plone/plone.app.vocabularies/commit/7bf7da97206a7ecd3f45563f015c468e2a98e607

Fix registry id
Use utf-8 as fallback encoding, since that's what we use elsewhere in core.

Files changed:
M plone/dexterity/browser/edit.py
M plone/app/vocabularies/catalog.py

diff --git a/plone/dexterity/browser/edit.py b/plone/dexterity/browser/edit.py
index 1eb4dce..4a01ecc 100644
--- a/plone/dexterity/browser/edit.py
+++ b/plone/dexterity/browser/edit.py
@@ -48,7 +48,7 @@ def nextURL(self):
if portal_type is not None:
registry = getUtility(IRegistry)
use_view_action = registry.get(
- 'plone.types_view_action_in_listings', [])
+ 'plone.types_use_view_action_in_listings', [])
if portal_type in use_view_action:
view_url = view_url + '/view'
return view_url
diff --git a/plone/app/vocabularies/catalog.py b/plone/app/vocabularies/catalog.py
index 1516b92..890cc72 100644
--- a/plone/app/vocabularies/catalog.py
+++ b/plone/app/vocabularies/catalog.py
@@ -154,9 +154,9 @@ def __init__(self, context, base_query={}, default_query=None):

registry = queryUtility(IRegistry)
if registry is not None:
- self.encoding = registry.get('plone.default_charset', 'ascii')
+ self.encoding = registry.get('plone.default_charset', 'utf-8')
else:
- self.encoding = 'ascii'
+ self.encoding = 'utf-8'

def __contains__(self, value):
"""Return whether the value is available in this source


Repository: plone.dexterity
Repository: plone.app.vocabularies


Branch: refs/heads/master
Date: 2015-09-20T17:31:26+02:00
Date: 2015-09-20T12:22:19+02:00
Author: esteele (esteele) <eric@esteele.net>
Commit: https://github.com/plone/plone.dexterity/commit/825042b5a4fc34759486398afb19fafce3e8a2c1
Commit: https://github.com/plone/plone.app.vocabularies/commit/5d75ed4a2203fe5c4c6d6f45ec13c3e44a3892ed

Handle missing portal_type value (seems to only be a test issue at this point)
Default to utf8

Files changed:
M plone/dexterity/browser/edit.py

diff --git a/plone/dexterity/browser/edit.py b/plone/dexterity/browser/edit.py
index 4a01ecc..29106b4 100644
--- a/plone/dexterity/browser/edit.py
+++ b/plone/dexterity/browser/edit.py
@@ -44,7 +44,7 @@ def handleCancel(self, action):
M plone/app/vocabularies/catalog.py

diff --git a/plone/app/vocabularies/catalog.py b/plone/app/vocabularies/catalog.py
index 890cc72..4379486 100644
--- a/plone/app/vocabularies/catalog.py
+++ b/plone/app/vocabularies/catalog.py
@@ -151,12 +151,7 @@ def __init__(self, context, base_query={}, default_query=None):
self.catalog = getToolByName(context, "portal_catalog")
self.portal_tool = getToolByName(context, "portal_url")
self.portal_path = self.portal_tool.getPortalPath()
-
- registry = queryUtility(IRegistry)
- if registry is not None:
- self.encoding = registry.get('plone.default_charset', 'utf-8')
- else:
- self.encoding = 'utf-8'
+ self.encoding = 'utf-8'

def nextURL(self):
view_url = self.context.absolute_url()
- portal_type = self.portal_type
+ portal_type = getattr(self, 'portal_type', None)
if portal_type is not None:
registry = getUtility(IRegistry)
use_view_action = registry.get(
def __contains__(self, value):
"""Return whether the value is available in this source


Repository: plone.dexterity
Repository: plone.app.vocabularies


Branch: refs/heads/master
Date: 2015-09-20T17:31:40+02:00
Date: 2015-09-20T17:33:05+02:00
Author: Philip Bauer (pbauer) <bauer@starzel.de>
Commit: https://github.com/plone/plone.dexterity/commit/69cd55d20ed910aab7a6fc65ee8020dccb723b46
Commit: https://github.com/plone/plone.app.vocabularies/commit/19a981f1e097c95c400e3d5520c3cdb70921cd09

Merge pull request #41 from plone/portal-properties-cleanup
Merge pull request #22 from plone/portal-properties-cleanup

Portal properties cleanup

Files changed:
M CHANGES.rst
M plone/dexterity/browser/edit.py
M plone/app/vocabularies/catalog.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 69d0bad..06111a0 100644
index e6506cd..188b75b 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -5,6 +5,9 @@ Changelog
2.3.5 (unreleased)
------------------
@@ -4,8 +4,8 @@ Changelog
2.1.22 (unreleased)
-------------------

+- Use registry lookup for types_use_view_action_in_listings
-- Nothing changed yet.
-
+- Pull default_charset value from the configuration registry.
+ [esteele]
+
- Don't check type constraints in AddForm.update() if request provides
IDeferSecurityChecks.
[alecm]
diff --git a/plone/dexterity/browser/edit.py b/plone/dexterity/browser/edit.py
index f891d25..29106b4 100644
--- a/plone/dexterity/browser/edit.py
+++ b/plone/dexterity/browser/edit.py
@@ -8,6 +8,7 @@
from plone.dexterity.i18n import MessageFactory as _
from plone.dexterity.interfaces import IDexterityEditForm
from plone.dexterity.interfaces import IDexterityFTI
+from plone.registry.interfaces import IRegistry
from plone.z3cform import layout
from z3c.form import button
from z3c.form import form
@@ -43,21 +44,13 @@ def handleCancel(self, action):

def nextURL(self):
view_url = self.context.absolute_url()
- portal_properties = getToolByName(self, 'portal_properties', None)
- if portal_properties is not None:
- site_properties = getattr(
- portal_properties,
- 'site_properties',
- None
- )
- portal_type = self.portal_type
- if site_properties is not None and portal_type is not None:
- use_view_action = site_properties.getProperty(
- 'typesUseViewActionInListings',
- ()
- )
- if portal_type in use_view_action:
- view_url = view_url + '/view'
+ portal_type = getattr(self, 'portal_type', None)
+ if portal_type is not None:
+ registry = getUtility(IRegistry)
+ use_view_action = registry.get(
+ 'plone.types_use_view_action_in_listings', [])
+ if portal_type in use_view_action:
+ view_url = view_url + '/view'
return view_url
2.1.21 (2015-09-07)
-------------------
diff --git a/plone/app/vocabularies/catalog.py b/plone/app/vocabularies/catalog.py
index 42b9c0e..4379486 100644
--- a/plone/app/vocabularies/catalog.py
+++ b/plone/app/vocabularies/catalog.py
@@ -3,12 +3,14 @@
from plone.app.querystring import queryparser
from plone.app.vocabularies import SlicableVocabulary
from plone.app.vocabularies.terms import BrowsableTerm
+from plone.registry.interfaces import IRegistry
from plone.uuid.interfaces import IUUID
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import safe_unicode
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.ZCTextIndex.ParseTree import ParseError
from zope.browser.interfaces import ITerms
+from zope.component import queryUtility
from zope.formlib.interfaces import ISourceQueryView
from zope.interface import implementer
from zope.interface import provider
@@ -149,11 +151,7 @@ def __init__(self, context, base_query={}, default_query=None):
self.catalog = getToolByName(context, "portal_catalog")
self.portal_tool = getToolByName(context, "portal_url")
self.portal_path = self.portal_tool.getPortalPath()
- try:
- self.encoding = getToolByName(
- context, "portal_properties").site_properties.default_charset
- except AttributeError:
- self.encoding = 'ascii'
+ self.encoding = 'utf-8'

def update(self):
def __contains__(self, value):
"""Return whether the value is available in this source


0 comments on commit 972337e

Please sign in to comment.