Commit 9d839e52 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fixup! erp5_web: introduce translatable path.

parent 0ea77886
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
############################################################################## ##############################################################################
import re import re
import six
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from erp5.component.document.Domain import Domain from erp5.component.document.Domain import Domain
...@@ -166,14 +167,14 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin): ...@@ -166,14 +167,14 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
def _getTranslatedPathDict(self): def _getTranslatedPathDict(self):
return getattr(self, INTERNAL_TRANSLATED_PATH_DICT_NAME, {}) return getattr(self, INTERNAL_TRANSLATED_PATH_DICT_NAME, {})
security.declareProtected(Permissions.ModifyPortalContent, 'updateTranslatedWebSectionList') security.declareProtected(Permissions.ModifyPortalContent, 'updateTranslatedPathDict')
def updateTranslatedPathDict(self, recursive=False): def updateTranslatedPathDict(self, recursive=False):
translated_path_dict = {} translated_path_dict = {}
available_language_list = self.getAvailableLanguageList() available_language_list = self.getAvailableLanguageList()
for section in self.objectValues(portal_type='Web Section'): for section in self.objectValues(portal_type='Web Section'):
section_id = section.getId() section_id = section.getId()
translated_section_id_dict = dict((k[1], v[1]) for k, v in section._getTranslationDict().items() \ translated_section_id_dict = {k[1]: v[1] for k, v in six.iteritems(section._getTranslationDict()) \
if k[0] == 'translatable_id' and v[0] == section_id) if k[0] == 'translatable_id' and v[0] == section_id}
for language in available_language_list: for language in available_language_list:
translated_section_id = translated_section_id_dict.get(language, section_id) translated_section_id = translated_section_id_dict.get(language, section_id)
checkValidId(self, translated_section_id, allow_dup=True) checkValidId(self, translated_section_id, allow_dup=True)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment