[gen] Bugfixes: handle multilingual titles in queries, references, breadcrumbs...

This commit is contained in:
Gaetan Delannay 2014-09-06 15:20:59 +02:00
parent f8a7103c7a
commit 8aed007623
6 changed files with 34 additions and 6 deletions

View file

@ -71,7 +71,8 @@ class Migrator:
'''Executes a migration when relevant, or do it for sure if p_force is
True.'''
appyVersion = self.tool.appyVersion
if force or not appyVersion or (appyVersion < '0.9.0'):
# appyVersion being None simply means that we are creating a new DB.
if force or (appyVersion and (appyVersion < '0.9.0')):
# Migration is required.
self.logger.info('Appy version (DB) is %s' % appyVersion)
startTime = time.time()

View file

@ -1298,7 +1298,7 @@ class BaseMixin:
def Title(self):
'''Returns the title for this object.'''
title = self.getAppyType('title')
if title: return title.getValue(self)
if title: return title.getIndexValue(self)
return self.id
def SortableTitle(self):
@ -1468,6 +1468,11 @@ class BaseMixin:
return False
if parent.meta_type not in ('Folder', 'Temporary Folder'): return parent
def getShownValue(self, name):
'''Call field.getShownValue on field named p_name.'''
field = self.getAppyType('title')
return field.getShownValue(self, field.getValue(self))
def getBreadCrumb(self, inPopup=False):
'''Gets breadcrumb info about this object and its parents (if it must
be shown).'''
@ -1475,8 +1480,9 @@ class BaseMixin:
klass = self.getClass()
if hasattr(klass, 'breadcrumb') and not klass.breadcrumb: return ()
# Compute the breadcrumb
title = self.getAppyType('title')
res = [Object(url=self.getUrl(inPopup=inPopup),
title=self.getFieldValue('title', layoutType='view'))]
title=title.getShownValue(self, title.getValue(self)))]
# In a popup: limit the breadcrumb to the current object.
if inPopup: return res
parent = self.getParent()

View file

@ -322,7 +322,7 @@ class ToolWrapper(AbstractWrapper):
var2="linkInPopup=inPopup or (target.target != '_self')"
target=":target.target" onclick=":target.openPopup"
href=":zobj.getUrl(nav=navInfo, page=zobj.getDefaultViewPage(), \
inPopup=linkInPopup)">:zobj.Title()</a>
inPopup=linkInPopup)">:zobj.getShownValue('title')</a>
<span if="not enableLinks"
class=":not checkboxes and cssClass or ('%s clickable' % cssClass)"
onclick=":checkboxes and ('onSelectObject(%s,%s,%s)' % (q(cbId), \