[gen] Bugfixes.
This commit is contained in:
parent
8511c22612
commit
50bd996c3b
|
@ -64,7 +64,7 @@ class Field:
|
||||||
value=not isSearch and \
|
value=not isSearch and \
|
||||||
field.getFormattedValue(zobj, rawValue, showChanges);
|
field.getFormattedValue(zobj, rawValue, showChanges);
|
||||||
requestValue=not isSearch and zobj.getRequestFieldValue(name);
|
requestValue=not isSearch and zobj.getRequestFieldValue(name);
|
||||||
inRequest=field.valueIsInRequest(zobj, req, name);
|
inRequest=field.valueIsInRequest(zobj, req, name, layoutType);
|
||||||
error=req.get('%s_error' % name);
|
error=req.get('%s_error' % name);
|
||||||
isMultiple=(field.multiplicity[1] == None) or \
|
isMultiple=(field.multiplicity[1] == None) or \
|
||||||
(field.multiplicity[1] > 1);
|
(field.multiplicity[1] > 1);
|
||||||
|
@ -654,7 +654,7 @@ class Field:
|
||||||
index = tool.getApp().catalog.Indexes[indexName]
|
index = tool.getApp().catalog.Indexes[indexName]
|
||||||
return index.getEntryForObject(catalogBrain.getRID())
|
return index.getEntryForObject(catalogBrain.getRID())
|
||||||
|
|
||||||
def valueIsInRequest(self, obj, request, name):
|
def valueIsInRequest(self, obj, request, name, layoutType):
|
||||||
'''Is there a value corresponding to this field in the request? p_name
|
'''Is there a value corresponding to this field in the request? p_name
|
||||||
can be different from self.name (ie, if it is a field within another
|
can be different from self.name (ie, if it is a field within another
|
||||||
(List) field). In most cases, checking that this p_name is in the
|
(List) field). In most cases, checking that this p_name is in the
|
||||||
|
|
|
@ -528,10 +528,14 @@ class String(Field):
|
||||||
if isinstance(res, dict): res = res.copy()
|
if isinstance(res, dict): res = res.copy()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def valueIsInRequest(self, obj, request, name):
|
def valueIsInRequest(self, obj, request, name, layoutType):
|
||||||
|
# If we are on the search layout, p_obj, if not None, is certainly not
|
||||||
|
# the p_obj we want here (can be a home object).
|
||||||
|
if layoutType == 'search':
|
||||||
|
return Field.valueIsInRequest(self, obj, request, name, layoutType)
|
||||||
languages = self.getAttribute(obj, 'languages')
|
languages = self.getAttribute(obj, 'languages')
|
||||||
if len(languages) == 1:
|
if len(languages) == 1:
|
||||||
return Field.valueIsInRequest(self, obj, request, name)
|
return Field.valueIsInRequest(self, obj, request, name, layoutType)
|
||||||
# Is is sufficient to check that at least one of the language-specific
|
# Is is sufficient to check that at least one of the language-specific
|
||||||
# values is in the request.
|
# values is in the request.
|
||||||
return request.has_key('%s_%s' % (name, languages[0]))
|
return request.has_key('%s_%s' % (name, languages[0]))
|
||||||
|
|
|
@ -218,17 +218,17 @@ class ToolMixin(BaseMixin):
|
||||||
- the number of columns for layouting those fields.'''
|
- the number of columns for layouting those fields.'''
|
||||||
fields = []
|
fields = []
|
||||||
if refInfo:
|
if refInfo:
|
||||||
# The search is triggered from a Ref field.
|
# The search is triggered from a Ref field
|
||||||
refObject, fieldName = self.getRefInfo(refInfo)
|
refObject, fieldName = self.getRefInfo(refInfo)
|
||||||
refField = refObject.getAppyType(fieldName)
|
refField = refObject.getAppyType(fieldName)
|
||||||
fieldNames = refField.queryFields or ()
|
fieldNames = refField.queryFields or ()
|
||||||
nbOfColumns = refField.queryNbCols
|
nbOfColumns = refField.queryNbCols
|
||||||
else:
|
else:
|
||||||
# The search is triggered from an app-wide search.
|
# The search is triggered from an app-wide search
|
||||||
klass = self.getAppyClass(className)
|
klass = self.getAppyClass(className)
|
||||||
fieldNames = getattr(klass, 'searchFields', None)
|
fieldNames = getattr(klass, 'searchFields', None)
|
||||||
if not fieldNames:
|
if not fieldNames:
|
||||||
# Gather all the indexed fields on this class.
|
# Gather all the indexed fields on this class
|
||||||
fieldNames = [f.name for f in self.getAllAppyTypes(className) \
|
fieldNames = [f.name for f in self.getAllAppyTypes(className) \
|
||||||
if f.indexed]
|
if f.indexed]
|
||||||
nbOfColumns = getattr(klass, 'numberOfSearchColumns', 3)
|
nbOfColumns = getattr(klass, 'numberOfSearchColumns', 3)
|
||||||
|
|
|
@ -550,7 +550,7 @@ class ToolWrapper(AbstractWrapper):
|
||||||
layoutType='search';
|
layoutType='search';
|
||||||
x=ztool.getCssJs(searchInfo.fields, 'edit', cssJs)">
|
x=ztool.getCssJs(searchInfo.fields, 'edit', cssJs)">
|
||||||
|
|
||||||
<!-- Include type-specific CSS and JS. -->
|
<!-- Include type-specific CSS and JS -->
|
||||||
<link for="cssFile in cssJs['css']" rel="stylesheet" type="text/css"
|
<link for="cssFile in cssJs['css']" rel="stylesheet" type="text/css"
|
||||||
href=":url(cssFile)"/>
|
href=":url(cssFile)"/>
|
||||||
<script for="jsFile in cssJs['js']" type="text/javascript"
|
<script for="jsFile in cssJs['js']" type="text/javascript"
|
||||||
|
|
|
@ -1071,6 +1071,11 @@ class AbstractWrapper(object):
|
||||||
indexes = []
|
indexes = []
|
||||||
for name in fields:
|
for name in fields:
|
||||||
field = self.getField(name)
|
field = self.getField(name)
|
||||||
|
if not field:
|
||||||
|
# The index may be a standard Appy index that does not
|
||||||
|
# correspond to a field.
|
||||||
|
indexes.append(name)
|
||||||
|
continue
|
||||||
if not field.indexed: continue
|
if not field.indexed: continue
|
||||||
# A field may have 2 different indexes
|
# A field may have 2 different indexes
|
||||||
iName = field.getIndexName(usage='search')
|
iName = field.getIndexName(usage='search')
|
||||||
|
|
Loading…
Reference in a new issue