Skip to content

Commit

Permalink
[fc] Repository: plone.app.content
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2017-10-05T12:31:32+02:00
Author: Johannes Raggam (thet) <[email protected]>
Commit: plone/plone.app.content@75d4d89

Allow ``plonejsi18n`` accept empty domains when calling.
This avoids ``BadRequest`` errors, when being called without a domain url query string.

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

Branch: refs/heads/master
Date: 2017-10-13T11:59:53+02:00
Author: Jens W. Klein (jensens) <[email protected]>
Commit: plone/plone.app.content@e790cd8

Merge pull request #140 from plone/thet-plonejsi18n-graceful

Allow ``plonejsi18n`` accept empty domains when calling.

Files changed:
M CHANGES.rst
M plone/app/content/browser/i18n.py
  • Loading branch information
jensens committed Oct 13, 2017
1 parent 309ce6b commit 46321d3
Showing 1 changed file with 104 additions and 29 deletions.
133 changes: 104 additions & 29 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,113 @@
Repository: Products.CMFPlone
Repository: plone.app.content


Branch: refs/heads/master
Date: 2017-10-13T00:16:50+02:00
Date: 2017-10-05T12:31:32+02:00
Author: Johannes Raggam (thet) <[email protected]>
Commit: https://github.com/plone/plone.app.content/commit/75d4d89e2a41db0df096b896774ec8bfd5930e80

Allow ``plonejsi18n`` accept empty domains when calling.
This avoids ``BadRequest`` errors, when being called without a domain url query string.

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

diff --git a/CHANGES.rst b/CHANGES.rst
index 61486c3..6a9e802 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -22,6 +22,9 @@ Bug fixes:

- Fix translations in the delete pop-over
[arsenico13]
+- Allow ``plonejsi18n`` accept empty domains when calling.
+ This avoids ``BadRequest`` errors, when being called without a domain url query string.
+ [thet]


3.4.4 (2017-08-27)
diff --git a/plone/app/content/browser/i18n.py b/plone/app/content/browser/i18n.py
index c8ce9f5..832c535 100644
--- a/plone/app/content/browser/i18n.py
+++ b/plone/app/content/browser/i18n.py
@@ -30,13 +30,15 @@ def _gettext_catalog(self, domain, language):
catalog = td._data[mo_path]._catalog
return catalog._catalog

- def __call__(self, domain, language=None):
+ def __call__(self, domain=None, language=None):
+
if domain is None:
- return
- if language is None:
- language = self.request['LANGUAGE']
+ catalog = {}
+ else:
+ if language is None:
+ language = self.request['LANGUAGE']
+ catalog = self._gettext_catalog(domain, language)

- catalog = self._gettext_catalog(domain, language)
response = self.request.response
response.setHeader('Content-Type', 'application/json; charset=utf-8')
response.setBody(json.dumps(catalog))


Repository: plone.app.content


Branch: refs/heads/master
Date: 2017-10-13T11:59:53+02:00
Author: Jens W. Klein (jensens) <[email protected]>
Commit: https://github.com/plone/Products.CMFPlone/commit/996d50924735c77fa3a248484e5c6f5c3bcef0f5
Commit: https://github.com/plone/plone.app.content/commit/e790cd8cf27d7405907ef5576bb6dd1d47e89c73

Merge pull request #140 from plone/thet-plonejsi18n-graceful

indent in zcml corrected
Allow ``plonejsi18n`` accept empty domains when calling.

Files changed:
M Products/CMFPlone/configure.zcml

diff --git a/Products/CMFPlone/configure.zcml b/Products/CMFPlone/configure.zcml
index f9cafba6c..5c2355b3f 100644
--- a/Products/CMFPlone/configure.zcml
+++ b/Products/CMFPlone/configure.zcml
@@ -101,12 +101,12 @@
trusted="y"
/>

- <!-- include plone plugins with z3c.autoinclude -->
- <includePlugins
- zcml:condition="not-have disable-autoinclude"
- package="plone"
- file="configure.zcml"
- />
+ <!-- include plone plugins with z3c.autoinclude -->
+ <includePlugins
+ zcml:condition="not-have disable-autoinclude"
+ package="plone"
+ file="configure.zcml"
+ />

<subscriber for="Products.GenericSetup.events.ProfileImportedEvent"
handler=".events.profileImportedEventHandler"/>
M CHANGES.rst
M plone/app/content/browser/i18n.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 4ceb4ef..36eaa79 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -22,6 +22,9 @@ Bug fixes:

- Fix translations in the delete pop-over
[arsenico13]
+- Allow ``plonejsi18n`` accept empty domains when calling.
+ This avoids ``BadRequest`` errors, when being called without a domain url query string.
+ [thet]

- Fix and optimize *getVocabulary*-view to work with alternate fulltext
indexes, which don't return brains as search results
diff --git a/plone/app/content/browser/i18n.py b/plone/app/content/browser/i18n.py
index c8ce9f5..832c535 100644
--- a/plone/app/content/browser/i18n.py
+++ b/plone/app/content/browser/i18n.py
@@ -30,13 +30,15 @@ def _gettext_catalog(self, domain, language):
catalog = td._data[mo_path]._catalog
return catalog._catalog

- def __call__(self, domain, language=None):
+ def __call__(self, domain=None, language=None):
+
if domain is None:
- return
- if language is None:
- language = self.request['LANGUAGE']
+ catalog = {}
+ else:
+ if language is None:
+ language = self.request['LANGUAGE']
+ catalog = self._gettext_catalog(domain, language)

- catalog = self._gettext_catalog(domain, language)
response = self.request.response
response.setHeader('Content-Type', 'application/json; charset=utf-8')
response.setBody(json.dumps(catalog))


0 comments on commit 46321d3

Please sign in to comment.