Commit a1846a03 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Implementation of compact title. Fix for isWebMode.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13334 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3648c203
...@@ -578,7 +578,6 @@ class Base( CopyContainer, ...@@ -578,7 +578,6 @@ class Base( CopyContainer,
psyco.bind(_aq_dynamic) psyco.bind(_aq_dynamic)
# Constructor # Constructor
def __init__(self, id, uid=None, rid=None, sid=None, **kw): def __init__(self, id, uid=None, rid=None, sid=None, **kw):
self.id = id self.id = id
...@@ -1920,13 +1919,37 @@ class Base( CopyContainer, ...@@ -1920,13 +1919,37 @@ class Base( CopyContainer,
with a type methode. with a type methode.
""" """
if self.hasShortTitle(): if self.hasShortTitle():
return self.getTranslatedShortTitle() r = self.getShortTitle()
if r: return r
if self.hasReference(): if self.hasReference():
return self.getReference() r = self.getReference()
if self.hasTitle(): if r: return r
return self.getTranslatedTitle() r = self.getTitle() # No need to test existence since all Base instances have this method
if r: return r # Also useful whenever title is calculated
return self.getId() return self.getId()
security.declareProtected(Permissions.AccessContentsInformation,
'getCompactTranslatedTitle')
def getCompactTranslatedTitle(self):
"""
Returns the translated short title or the reference or
the translated title or the ID by order of priority
NOTE: It could be useful to make this method overridable
with a type methode.
"""
if self.hasShortTitle():
r = self.getTranslatedShortTitle()
if r: return r
r = self.getShortTitle()
if r: return r
if self.hasReference():
r = self.getReference()
if r: return r
r = self.getTranslatedTitle() # No need to test existence since all Base instances have this method
if r: return r # Also useful whenever title is calculated
return self.getId()
# This method allows to sort objects in list is a more reasonable way # This method allows to sort objects in list is a more reasonable way
security.declareProtected(Permissions.View, 'getIntId') security.declareProtected(Permissions.View, 'getIntId')
def getIntId(self): def getIntId(self):
...@@ -2525,7 +2548,7 @@ class Base( CopyContainer, ...@@ -2525,7 +2548,7 @@ class Base( CopyContainer,
def isWebMode(self): def isWebMode(self):
if self.getApplicableLayout() is None: if self.getApplicableLayout() is None:
return False return False
if getattr(self.REQUEST, 'ignore_layout', None) is not None: if getattr(self.REQUEST, 'ignore_layout', 0):
return False return False
if getattr(self.REQUEST, 'editable_mode', 0): if getattr(self.REQUEST, 'editable_mode', 0):
return False return False
......
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