Sorry I'm late for the party, but I still have a Plone 4.3 instance with Archetypes content ...
When I tried to save an object with the package activated, I found the SearchableText patch to fail:
Traceback (innermost last):
...
Module Products.ZCTextIndex.ZCTextIndex, line 184, in index_object
Module experimental.gracefulblobmissing.patches, line 107, in patched_SearchableText
**TypeError: map() requires at least two args**
I shortened this a bit because the cause is truly local:
In this code:
# Unmangle vocabulary: we index key AND value
vocab_values = map( # A
lambda value, vocab=vocab: ( # B
vocab.getValue(value, ''),
datum
) # B
) # A
we have really just one argument to the map internal function.
As Python 2.7 puts it, at least; and that's the interpreter which is most likely to run this code.
I have a patch which takes the respective code block from Archetypes v1.9.21 and fixes the issue (for me, at least):
Index: experimental/gracefulblobmissing/patches.py
===================================================================
--- experimental/gracefulblobmissing/patches.py (revision 54244)
+++ experimental/gracefulblobmissing/patches.py (working copy)
@@ -101,17 +101,18 @@
datum = ''
if datum:
vocab = field.Vocabulary(self)
- if isinstance(datum, list) or isinstance(datum, tuple):
+ # ------------ [ code from Products.Archetypes v1.9.21 ... [
+ if isinstance(datum, (list, tuple)):
# Unmangle vocabulary: we index key AND value
- vocab_values = map(
- lambda value, vocab=vocab: (
- vocab.getValue(value, ''),
- datum
- )
- )
+ vocab_values = map(lambda value, vocab=vocab: vocab.getValue(value, ''), datum)
+ vocab_values = [
+ v.encode('utf-8') if isinstance(v, unicode) else v
+ for v in vocab_values
+ ]
datum = list(datum)
datum.extend(vocab_values)
datum = ' '.join(datum)
+ # ------------ ] ... code from Products.Archetypes v1.9.21 ]
elif isinstance(datum, basestring):
# Note: this patched function is only used in Archetypes,
# so the Python2-only code is fine.
Sadly I couldn't find a branch, tag or whatever where to put it in this repo.
Could we have a bugfix release 1.1, please?
Otherwise I'd need to use a "local" release.
Sorry I'm late for the party, but I still have a Plone 4.3 instance with Archetypes content ...
When I tried to save an object with the package activated, I found the SearchableText patch to fail:
I shortened this a bit because the cause is truly local: In this code:
we have really just one argument to the map internal function. As Python 2.7 puts it, at least; and that's the interpreter which is most likely to run this code.
I have a patch which takes the respective code block from Archetypes v1.9.21 and fixes the issue (for me, at least):
Sadly I couldn't find a branch, tag or whatever where to put it in this repo.
Could we have a bugfix release 1.1, please? Otherwise I'd need to use a "local" release.