From a37481c76e8b11b5fcdaa0409d8b15fa5e3c0b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20G=C3=B3rny?= <bartek@gorny.edu.pl> Date: Wed, 31 Jan 2007 17:20:54 +0000 Subject: [PATCH] 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 --- product/ERP5/Document/Document.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/product/ERP5/Document/Document.py b/product/ERP5/Document/Document.py index 63ab9cffe6..d9e6bf5b3e 100644 --- a/product/ERP5/Document/Document.py +++ b/product/ERP5/Document/Document.py @@ -691,13 +691,14 @@ class Document(XMLObject): Returns a list of languages which this document is available in for the current user. """ + if not self.getReference(): return [] catalog = getToolByName(self, 'portal_catalog', None) - return map(lambda o:o.getLanguage(), - catalog(portal_type=self.getPortalType(), + kw = dict(portal_type=self.getPortalType(), 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') def getOriginalLanguage(self): -- 2.30.9