[Zope-CMF] Re: found actions bug in CMF HEAD and CMF 1.4 I suppose
Grégoire Weber
gregoire.weber@switzerland.org
Thu, 03 Jul 2003 23:32:22 +0200
Hi Yvo,
>Note: Migrating existing TypeInformation objects should work correctly.=
This is about adding new TypeInformations using oldstyle factory_type_information data.
Ok, that's right. "Old" products (originally written for CMF 1.3.x) do
that usually.
>Gregoire Weber wrote:
>>while playing around with ArchExample (from Archetypes) which
>>uses old string based actions (not TALES actions) I found out that CMF=
HEAD of 2003/07/03 of about 1200+0200 does not convert the last action of a fti to a TALES expression.
>
>How did you find out? Error? Traceback?
I installed CMF head and Archetypes thursday lunch time and Plone head
and ArchExample head from about three days ago.
I first had a traceback (see below). Same traceback for CMFMember, ArchExample
and ReviewStorageExample (all archetypes products). I first thought the
problem would lie in archetypes.
The action causing the exception had "standard:'/portal_form/foo_bar'" as
action (or something similar).
Then I debugged for about 3 hours with two computers in parallel :-)
to find out that _cloneActions() in addAction() actually converts
actions from strings to TALES as side effect.
>>Have a look at ActionProviderBase.py method addAction:
>> new_actions = self._cloneActions() # line 114
>> does the conversion of string actions to TALES actions
>> (the conversion is actually done in getActionExpression
>> in ActionInformation.py).
>> then the new action is created (but not converted !!!):
>> new_action = ActionInformation(...)
>
>using 'a_expr', created in line 108:
>
> a_expr = action and Expression(text=str(action)) or ''
>
>So we have an Expression, but without a leading "string:".
>That smells like a bug. I'll write a test for this scenario
>and see what has to be done.
That's exactly what I saw during my debugging session. But I
it wasn't obvious for me where to put a correction.
The whole action code seems to be more complex to me as it should.
This is possibly caused by this backwards compatibility stuff.
I tried to do a more intelleigent fix, but then produced other
errors in other locations :-(.
The fix mentioned works for me at the moment.
Contact me if you need more information.
>>P.S.: It seems that is the bug we searched at the Plone sprint in Padua:=
see thread "some CMF 1.4beta1 issues" in may
>
>Don't think so. Judging from the traceback you sent me, your action was no=
Expression at all.
Ok, I can't really remember that exactly.
Yvo: Hoffe, du hast eine gute Zeit bei dir in Berlin!
Gregoire
------------------------------ traceback ------------------------------
>File=
"E:\user\greg\data\Zope\inst\alstom1_dev\Products\CMFQuickInstallerTool\QuickInstallerTool.py", line 190, in
>installProduct
>res=install()
>
>File=
"D:\PROGRA~1\zope\zope26\lib\python\Products\ExternalMethod\ExternalMethod.py", line 231, in __call__
>return apply(f,(self.aq_parent.this(),)+args,kw)
>
>File=
"E:\user\greg\data\Zope\inst\alstom1_dev\Products\ArchExample\Extensions\Install.py", line 12, in install
>PROJECTNAME)
>
>File=
"E:\user\greg\data\Zope\inst\alstom1_dev\Products\Archetypes\Extensions\utils.py", line 328, in installTypes
>install_types(self, out, ftypes, package_name)
>
>File=
"E:\user\greg\data\Zope\inst\alstom1_dev\Products\Archetypes\Extensions\utils.py", line 112, in install_types
>typeinfo_name=typeinfo_name)
>
>File=
"E:\user\greg\data\Zope\inst\alstom1_dev\Products\CMFCore\TypesTool.py", line 754, in
>manage_addTypeInformation
>ob = apply(klass, (id,), fti)
>
>File=
"E:\user\greg\data\Zope\inst\alstom1_dev\Products\CMFCore\TypesTool.py", line 153, in __init__
>self._guessMethodAliases()
>
>File=
"E:\user\greg\data\Zope\inst\alstom1_dev\Products\CMFCore\TypesTool.py", line 431, in _guessMethodAliases
>defmethod = action.action(context).strip()
>
>File=
"E:\user\greg\data\Zope\inst\alstom1_dev\Products\CMFCore\Expression.py", line 44, in __call__
>res = compiled(econtext)
>
>File=
"D:\PROGRA~1\zope\zope26\lib\python\Products\PageTemplates\Expressions.py", line 206, in __call__
>return self._eval(econtext)
>
>File=
"D:\PROGRA~1\zope\zope26\lib\python\Products\PageTemplates\Expressions.py", line 194, in _eval
>ob = self._subexprs[-1](econtext)
>
>File=
"D:\PROGRA~1\zope\zope26\lib\python\Products\PageTemplates\Expressions.py", line 146, in _eval
>ob = vars[base]
>
>KeyError: portal_form
_____________________________________
Grégoire Weber
Rigistr. 31
CH-8006 Zürich
Switzerland
phone: +41-(0)1-361 66 11
mobile: +41-(0)79-44 11 457
mailto:gregoire.weber@switzerland.org