[gen] Bugfixes in the search machinery.

This commit is contained in:
Gaetan Delannay 2015-01-02 16:16:48 +01:00
parent cf2cbc52d6
commit 225ea927a4
16 changed files with 81 additions and 43 deletions

View file

@ -39,7 +39,7 @@ class Computed(Field):
masterValue=None, focus=False, historized=False, mapping=None,
label=None, sdefault='', scolspan=1, swidth=None, sheight=None,
context=None, view=None, xml=None):
# The Python method used for computing the field value, or a PX.
# The Python method used for computing the field value, or a PX
self.method = method
# A specific method for producing the formatted value of this field.
# This way, if, for example, the value is a DateTime instance which is
@ -53,7 +53,7 @@ class Computed(Field):
# Does field computation produce plain text or XHTML?
self.plainText = plainText
if isinstance(method, Px):
# When field computation is done with a PX, the result is XHTML.
# When field computation is done with a PX, the result is XHTML
self.plainText = False
# Determine default value for "show"
if show == None:
@ -62,7 +62,7 @@ class Computed(Field):
# in the xml layout.
show = self.plainText and ('view', 'result', 'xml') or \
('view', 'result')
# If method is a PX, its context can be given in p_context.
# If method is a PX, its context can be given in p_context
self.context = context
Field.__init__(self, None, multiplicity, default, show, page, group,
layouts, move, indexed, mustIndex, searchable,

View file

@ -275,9 +275,9 @@ class Pod(Field):
move, False, True, False, specificReadPermission,
specificWritePermission, width, height, None, colspan,
master, masterValue, focus, historized, mapping, label,
None, None, None, None, True, view, xml)
# Param "persist" is set to True but actually, persistence for a pod
# field is determined by freezing.
None, None, None, None, False, view, xml)
# Param "persist" is False, but actual persistence for this field is
# determined by freezing.
self.validable = False
def getExtension(self, template):
@ -603,7 +603,7 @@ class Pod(Field):
when no p_upload file is specified), if the freezing fails we try to
freeze the odt version, which is more robust because it does not
require calling LibreOffice.'''
# Security check.
# Security check
if not noSecurity and \
(format not in self.getFreezeFormats(obj, template)):
raise Exception(self.UNAUTHORIZED)
@ -613,10 +613,10 @@ class Pod(Field):
fileName = self.getFreezeName(template, format)
result = os.path.join(dbFolder, folder, fileName)
if os.path.exists(result):
prefix = upload and 'Freeze (upload)' or 'Freeze'
prefix = upload and 'freeze (upload)' or 'freeze'
obj.log('%s: overwriting %s...' % (prefix, result))
if not upload:
# Generate the document.
# Generate the document
doc = self.getValue(obj, template=template, format=format,
result=result)
if isinstance(doc, basestring):
@ -640,7 +640,7 @@ class Pod(Field):
raise Exception(self.FREEZE_FATAL_ERROR)
obj.log('freezed at %s.' % result)
else:
# Store the uploaded file in the database.
# Store the uploaded file in the database
f = file(result, 'wb')
doc = FileInfo(result, inDb=False)
doc.replicateFile(upload, f)