Commit a37481c7 authored by Bartek Górny's avatar Bartek Górny

in getLanguageList provide for version being None, and fail if self has no reference

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12490 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c66759d2
...@@ -691,13 +691,14 @@ class Document(XMLObject): ...@@ -691,13 +691,14 @@ class Document(XMLObject):
Returns a list of languages which this document is available in Returns a list of languages which this document is available in
for the current user. for the current user.
""" """
if not self.getReference(): return []
catalog = getToolByName(self, 'portal_catalog', None) catalog = getToolByName(self, 'portal_catalog', None)
return map(lambda o:o.getLanguage(), kw = dict(portal_type=self.getPortalType(),
catalog(portal_type=self.getPortalType(),
reference=self.getReference(), reference=self.getReference(),
version=version, group_by=('language',))
group_by=('language',), if version is not None:
)) kw['version'] = version
return map(lambda o:o.getLanguage(), catalog(**kw))
security.declareProtected(Permissions.View, 'getOriginalLanguage') security.declareProtected(Permissions.View, 'getOriginalLanguage')
def getOriginalLanguage(self): def getOriginalLanguage(self):
......
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