[gen] Bugfixes in the management of indexes.

This commit is contained in:
Gaetan Delannay 2012-10-05 16:38:15 +02:00
parent 7a38892cee
commit 64e1ace32c
3 changed files with 7 additions and 3 deletions

View file

@ -1 +1 @@
0.8.1 0.8.2

View file

@ -7,7 +7,7 @@ from appy.gen.layout import Table
from appy.gen.layout import defaultFieldLayouts from appy.gen.layout import defaultFieldLayouts
from appy.gen.po import PoMessage from appy.gen.po import PoMessage
from appy.gen.mail import sendNotification from appy.gen.mail import sendNotification
from appy.gen.indexer import defaultIndexes from appy.gen.indexer import defaultIndexes, XhtmlTextExtractor
from appy.gen.utils import GroupDescr, Keywords, getClassName, SomeObjects from appy.gen.utils import GroupDescr, Keywords, getClassName, SomeObjects
import appy.pod import appy.pod
from appy.pod.renderer import Renderer from appy.pod.renderer import Renderer
@ -1304,6 +1304,10 @@ class String(Type):
res = Type.getIndexValue(self, obj, forSearch) res = Type.getIndexValue(self, obj, forSearch)
if isinstance(res, unicode): if isinstance(res, unicode):
res = res.encode('utf-8') res = res.encode('utf-8')
if res and forSearch and (self.format == String.XHTML):
# Convert the value to simple text.
extractor = XhtmlTextExtractor(raiseOnError=False)
res = extractor.parse('<p>%s</p>' % res)
# Ugly catalog: if I give an empty tuple as index value, it keeps the # Ugly catalog: if I give an empty tuple as index value, it keeps the
# previous value. If I give him a tuple containing an empty string, it # previous value. If I give him a tuple containing an empty string, it
# is ok. # is ok.

View file

@ -8,7 +8,7 @@ from appy.shared.utils import normalizeText
# Default Appy indexes --------------------------------------------------------- # Default Appy indexes ---------------------------------------------------------
defaultIndexes = { defaultIndexes = {
'State': 'FieldIndex', 'UID': 'FieldIndex', 'Title': 'TextIndex', 'State': 'FieldIndex', 'UID': 'FieldIndex', 'Title': 'TextIndex',
'SortableTitle': 'FieldIndex', 'SearchableText': 'XhtmlIndex', 'SortableTitle': 'FieldIndex', 'SearchableText': 'TextIndex',
'Creator': 'FieldIndex', 'Created': 'DateIndex', 'ClassName': 'FieldIndex', 'Creator': 'FieldIndex', 'Created': 'DateIndex', 'ClassName': 'FieldIndex',
'Allowed': 'KeywordIndex'} 'Allowed': 'KeywordIndex'}