--- a/src/pyams_content/shared/blog/zmi/__init__.py Fri Jul 20 00:41:18 2018 +0200
+++ b/src/pyams_content/shared/blog/zmi/__init__.py Fri Jul 20 01:02:00 2018 +0200
@@ -19,7 +19,7 @@
# import interfaces
from pyams_content.interfaces import CREATE_CONTENT_PERMISSION
from pyams_content.shared.blog.interfaces import IWfBlogPost, IBlogManager
-from pyams_i18n.interfaces import II18n, II18nManager
+from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
from pyams_skin.interfaces.viewlet import IMenuHeader, IWidgetTitleViewletManager
from pyams_skin.layer import IPyAMSLayer
from pyams_workflow.interfaces import IWorkflowVersions, IWorkflowInfo
@@ -32,9 +32,10 @@
from pyams_skin.interfaces import IContentTitle
from pyams_skin.viewlet.toolbar import ToolbarAction
from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter, ContextRequestAdapter
+from pyams_utils.registry import get_utility
from pyams_utils.traversing import get_parent
from pyams_utils.unicode import translate_string
-from pyams_utils.url import absolute_url
+from pyams_utils.url import absolute_url, generate_url
from pyams_viewlet.viewlet import viewlet_config
from pyramid.decorator import reify
from pyramid.path import DottedNameResolver
@@ -98,11 +99,13 @@
def update_content(self, content, data):
data = data.get(self, data)
# initialize content fields
+ lang = get_utility(INegotiator).server_language
+ content.creator = self.request.principal.id
+ content.owner = self.request.principal.id
content.title = data['title']
content.short_name = content.title.copy()
+ content.content_url = generate_url(content.title.get(lang, ''))
content.notepad = data.get('notepad')
- content.creator = self.request.principal.id
- content.owner = self.request.principal.id
# check blog folders
now = datetime.utcnow()
year, month = now.strftime('%Y:%m').split(':')
--- a/src/pyams_content/shared/site/zmi/__init__.py Fri Jul 20 00:41:18 2018 +0200
+++ b/src/pyams_content/shared/site/zmi/__init__.py Fri Jul 20 01:02:00 2018 +0200
@@ -20,7 +20,7 @@
from pyams_content.interfaces import CREATE_CONTENT_PERMISSION
from pyams_content.shared.common.interfaces import IWfSharedContent
from pyams_content.shared.site.interfaces import ISiteContainer, ISiteManager, IWfTopic
-from pyams_i18n.interfaces import II18nManager
+from pyams_i18n.interfaces import II18nManager, INegotiator
from pyams_skin.interfaces.viewlet import IToolbarAddingMenu, IMenuHeader
from pyams_skin.layer import IPyAMSLayer
from pyams_workflow.interfaces import IWorkflowInfo, IWorkflowVersions
@@ -37,7 +37,7 @@
from pyams_utils.adapter import adapter_config, ContextRequestAdapter
from pyams_utils.registry import get_utility
from pyams_utils.traversing import get_parent
-from pyams_utils.url import absolute_url
+from pyams_utils.url import absolute_url, generate_url
from pyams_viewlet.viewlet import viewlet_config
from pyramid.decorator import reify
from pyramid.path import DottedNameResolver
@@ -114,11 +114,13 @@
def update_content(self, content, data):
data = data.get(self, data)
# initialize content fields
+ lang = get_utility(INegotiator).server_language
+ content.creator = self.request.principal.id
+ content.owner = self.request.principal.id
content.title = data['title']
content.short_name = content.title.copy()
+ content.content_url = generate_url(content.title.get(lang, ''))
content.notepad = data.get('notepad')
- content.creator = self.request.principal.id
- content.owner = self.request.principal.id
# get parent
intids = get_utility(IIntIds)
parent = intids.queryObject(data.get('parent'))