Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aaron Chen
erp5
Commits
614d972d
Commit
614d972d
authored
May 21, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Type: return translated accessors in getInstancePropertySet
parent
6aba5799
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
product/ERP5/tests/testContentTranslation.py
product/ERP5/tests/testContentTranslation.py
+6
-0
product/ERP5Type/ERP5Type.py
product/ERP5Type/ERP5Type.py
+14
-1
No files found.
product/ERP5/tests/testContentTranslation.py
View file @
614d972d
...
@@ -233,6 +233,12 @@ class TestContentTranslation(ERP5TypeTestCase):
...
@@ -233,6 +233,12 @@ class TestContentTranslation(ERP5TypeTestCase):
self
.
assertEqual
(
address
.
getTranslatedStreetAddress
(
language
=
'ja-kana'
),
'東京都 台東区'
)
self
.
assertEqual
(
address
.
getTranslatedStreetAddress
(
language
=
'ja-kana'
),
'東京都 台東区'
)
def
test_getInstancePropertySet
(
self
):
"""Translatable properies are returned by getInstancePropertySet
"""
self
.
assertTrue
(
'en_translated_first_name'
in
self
.
portal
.
portal_types
.
Person
.
getInstancePropertySet
())
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestContentTranslation
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestContentTranslation
))
...
...
product/ERP5Type/ERP5Type.py
View file @
614d972d
...
@@ -43,6 +43,7 @@ from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
...
@@ -43,6 +43,7 @@ from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
=
'ERP5Type_asSecurityGroupId'
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
=
'ERP5Type_asSecurityGroupId'
from
TranslationProviderBase
import
TranslationProviderBase
from
TranslationProviderBase
import
TranslationProviderBase
from
Products.ERP5Type.Accessor.Translation
import
TRANSLATION_DOMAIN_CONTENT_TRANSLATION
from
sys
import
exc_info
from
sys
import
exc_info
from
zLOG
import
LOG
,
ERROR
from
zLOG
import
LOG
,
ERROR
...
@@ -518,7 +519,8 @@ class ERP5TypeInformation(XMLObject,
...
@@ -518,7 +519,8 @@ class ERP5TypeInformation(XMLObject,
"""
"""
Return all the properties of the Portal Type
Return all the properties of the Portal Type
"""
"""
cls
=
self
.
getPortalObject
().
portal_types
.
getPortalTypeClass
(
self
.
getId
())
portal
=
self
.
getPortalObject
()
cls
=
portal
.
portal_types
.
getPortalTypeClass
(
self
.
getId
())
return_set
=
set
()
return_set
=
set
()
for
property_dict
in
cls
.
getAccessorHolderPropertyList
(
content
=
True
):
for
property_dict
in
cls
.
getAccessorHolderPropertyList
(
content
=
True
):
if
property_dict
[
'type'
]
==
'content'
:
if
property_dict
[
'type'
]
==
'content'
:
...
@@ -530,6 +532,17 @@ class ERP5TypeInformation(XMLObject,
...
@@ -530,6 +532,17 @@ class ERP5TypeInformation(XMLObject,
if
property_dict
[
'storage_id'
]:
if
property_dict
[
'storage_id'
]:
return_set
.
add
(
property_dict
[
'storage_id'
])
return_set
.
add
(
property_dict
[
'storage_id'
])
if
property_dict
[
'translatable'
]:
domain_dict
=
self
.
getPropertyTranslationDomainDict
()
domain
=
domain_dict
.
get
(
property_dict
[
'id'
])
if
domain
is
None
:
continue
if
domain
.
getDomainName
()
==
TRANSLATION_DOMAIN_CONTENT_TRANSLATION
:
for
language
in
portal
.
Localizer
.
get_languages
():
return_set
.
add
(
'%s_translated_%s'
%
(
language
.
replace
(
'-'
,
'_'
),
property_dict
[
'id'
]))
return
return_set
return
return_set
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment