[gen] Bugfix: getFormattedValue must produce a different value for strings with format=TEXT depending on the layout type.

This commit is contained in:
Gaetan Delannay 2015-03-06 15:54:14 +01:00
parent a4a9acfcfb
commit 4009cf824c
12 changed files with 62 additions and 46 deletions

View file

@ -150,11 +150,12 @@ class ToolWrapper(AbstractWrapper):
</script>''')
pxLiveSearchResults = Px('''
<x var="className=req['className'];
klass=ztool.getAppyClass(className);
search=ztool.getLiveSearch(klass, req['w_SearchableText']);
zobjects=ztool.executeQuery(className, search=search, \
maxResults=10).objects">
<div var="className=req['className'];
klass=ztool.getAppyClass(className);
search=ztool.getLiveSearch(klass, req['w_SearchableText']);
zobjects=ztool.executeQuery(className, search=search, \
maxResults=10).objects"
id=":'%s_LSResults' % className">
<p if="not zobjects" class="lsNoResult">:_('query_no_result')</p>
<div for="zobj in zobjects" style="padding: 3px 5px">
<a href=":zobj.absolute_url()"
@ -167,7 +168,7 @@ class ToolWrapper(AbstractWrapper):
onclick=":'document.forms[%s].submit()' % \
q('%s_LSForm' % className)">:_('search_results_all') + '...'</a>
</div>
</x>''')
</div>''')
pxLiveSearch = Px('''
<form var="formId='%s_LSForm' % className"

View file

@ -44,7 +44,7 @@ class AbstractWrapper(object):
<x for="bc in breadcrumb" var2="nb=loop.bc.nb">
<img if="nb != 0" src=":url('to')"/>
<!-- Display only the title of the current object -->
<span if="nb == len(breadcrumb)-1">:bc.title</span>
<span if="nb == len(breadcrumb)-1">::bc.title</span>
<!-- Display a link for parent objects -->
<a if="nb != len(breadcrumb)-1" href=":bc.url">:bc.title</a>
</x>
@ -874,7 +874,7 @@ class AbstractWrapper(object):
def getField(self, name): return self.o.getAppyType(name)
def getValue(self, name, formatted=False, language=None):
def getValue(self, name, layoutType='view', formatted=False, language=None):
'''Gets the possibly p_formatted value of field p_name. If this
formatting implies translating something, it will be done in
p_language, or in the user language if not specified. If the "shown"
@ -887,7 +887,7 @@ class AbstractWrapper(object):
if not formatted: return val
method = (formatted == 'shown') and 'getShownValue' or \
'getFormattedValue'
return getattr(field, method)(obj, val, language=language)
return getattr(field, method)(obj, val, layoutType, language=language)
def getLabel(self, name, type='field'):
'''Gets the translated label of field named p_name. If p_type is