appy.gen: bugfix while indexing empty string values: bugfix while accessing object from a query without security enabled.
This commit is contained in:
parent
312b1f4cef
commit
3fc5bc8418
|
@ -1176,6 +1176,7 @@ class String(Type):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
emptyStringTuple = ('',)
|
emptyStringTuple = ('',)
|
||||||
|
emptyValuesCatalogIgnored = (None, '')
|
||||||
def getIndexValue(self, obj, forSearch=False):
|
def getIndexValue(self, obj, forSearch=False):
|
||||||
'''For indexing purposes, we return only strings, not unicodes.'''
|
'''For indexing purposes, we return only strings, not unicodes.'''
|
||||||
res = Type.getIndexValue(self, obj, forSearch)
|
res = Type.getIndexValue(self, obj, forSearch)
|
||||||
|
@ -1185,6 +1186,9 @@ class String(Type):
|
||||||
# portal_catalog keeps the previous value! If I give him a tuple
|
# portal_catalog keeps the previous value! If I give him a tuple
|
||||||
# containing an empty string, it is ok.
|
# containing an empty string, it is ok.
|
||||||
if isinstance(res, tuple) and not res: res = self.emptyStringTuple
|
if isinstance(res, tuple) and not res: res = self.emptyStringTuple
|
||||||
|
# Ugly portal_catalog: if value is an empty string or None, it keeps
|
||||||
|
# the previous index value!
|
||||||
|
if res in self.emptyValuesCatalogIgnored: res = ' '
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def getPossibleValues(self,obj,withTranslations=False,withBlankValue=False):
|
def getPossibleValues(self,obj,withTranslations=False,withBlankValue=False):
|
||||||
|
|
|
@ -362,7 +362,9 @@ class AbstractWrapper:
|
||||||
for brain in self.tool.o.executeQuery(contentType, search=search, \
|
for brain in self.tool.o.executeQuery(contentType, search=search, \
|
||||||
brainsOnly=True, maxResults=maxResults, noSecurity=noSecurity):
|
brainsOnly=True, maxResults=maxResults, noSecurity=noSecurity):
|
||||||
# Get the Appy object from the brain
|
# Get the Appy object from the brain
|
||||||
obj = brain.getObject().appy()
|
if noSecurity: method = '_unrestrictedGetObject'
|
||||||
|
else: method = 'getObject'
|
||||||
|
exec 'obj = brain.%s().appy()' % method
|
||||||
exec expression
|
exec expression
|
||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue