#9: Plone 2.1 Compatibility
- Contents
Fix issues with CMFQuestions for Plone 2.1
- Proposed by
- adamu
- Proposal type
- Architecture
- Assigned to release
- State
- completed
Motivation
Several users have reported problems with getting CMFQuestions to work with Plone 2.1.
Proposal
I will need to install Plone 2.1 probably on a windows machine because it seems that this is where the problem lies. Then go in and try and fix the code to get it to work with Plone 2.1. Some of the errors already reported are.
Site Error
An error was encountered while publishing this resource.
AttributeError
Sorry, a site error occurred.
Traceback (innermost last):
* Module ZPublisher.Publish, line 187, in publish_module_standard
* Module Products.PlacelessTranslationService.PatchStringIO, line 51, in new_publish
* Module ZPublisher.Publish, line 144, in publish
* Module Zope2.App.startup, line 199, in zpublisher_exception_hook
* Module ZPublisher.Publish, line 113, in publish
* Module ZPublisher.mapply, line 88, in mapply
* Module ZPublisher.Publish, line 40, in call_object
* Module Shared.DC.Scripts.Bindings, line 311, in __call__
* Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
* Module Products.CMFCore.FSPageTemplate, line 188, in _exec
* Module Products.CMFCore.FSPageTemplate, line 127, in pt_render
* Module Products.PageTemplates.PageTemplate, line 102, in pt_render
<FSPageTemplate at /giving/portal_skins/questions/question_edit_form>
* Module TAL.TALInterpreter, line 190, in __call__
* Module TAL.TALInterpreter, line 234, in interpret
* Module TAL.TALInterpreter, line 671, in do_useMacro
* Module TAL.TALInterpreter, line 234, in interpret
* Module TAL.TALInterpreter, line 409, in do_optTag_tal
* Module TAL.TALInterpreter, line 394, in do_optTag
* Module TAL.TALInterpreter, line 389, in no_tag
* Module TAL.TALInterpreter, line 234, in interpret
* Module TAL.TALInterpreter, line 702, in do_defineSlot
* Module TAL.TALInterpreter, line 234, in interpret
* Module TAL.TALInterpreter, line 409, in do_optTag_tal
* Module TAL.TALInterpreter, line 394, in do_optTag
* Module TAL.TALInterpreter, line 389, in no_tag
* Module TAL.TALInterpreter, line 234, in interpret
* Module TAL.TALInterpreter, line 650, in do_defineMacro
* Module TAL.TALInterpreter, line 234, in interpret
* Module TAL.TALInterpreter, line 694, in do_defineSlot
* Module TAL.TALInterpreter, line 234, in interpret
* Module TAL.TALInterpreter, line 460, in do_setLocal_tal
* Module Products.PageTemplates.TALES, line 221, in evaluate
URL: file:CMFQuestions/skins/questions/question_edit_form.pt
Line 148, Column 20
Expression: <PythonExpr here.getQuestion(request['qid'])>
Names:
> Time
> 2005-09-27 14:30
> User Name (User Id)
> zope (zope)
> Request URL
> questionnaire.2005-09-27.8341746499/questionnaire_edit_form
> Exception Type
> PTRuntimeError
> Exception Value
> Page Template questionnaire_edit_form has errors.
>
> Traceback (innermost last):
>
> * Module ZPublisher.Publish , line 113, in publish
> * Module ZPublisher.mapply, line 88, in mapply
> * Module ZPublisher.Publish, line 40, in call_object
> * Module Shared.DC.Scripts.Bindings, line 311, in __call__
> * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
> * Module Products.CMFCore.FSPageTemplate, line 188, in _exec
> * Module Products.CMFCore.FSPageTemplate, line 127, in pt_render
> * Module Products.PageTemplates.PageTemplate, line 94, in pt_render
> *<FSPageTemplate at /giving/questionnaire_edit_form used for
> /giving/payroll/questionnaire.2005-09-27.8341746499 >*
> *Warning: Compilation failed*
> *Warning: TAL.TALDefs.TALError: Python expression error: invalid
> syntax (question_edit_form?qid=%s' % ( here.absolute_url(),
> qid)", line 1) in expression "python:
> '%s/question_edit_form?qid=%s' % (\r\n here.absolute_url(),
> qid)", at line 40, column 12*
Progress log
I installed a clean version of Plone2.1 on Mac OS X using the installer and CMFQuestions0.4 seems to work with no problems. The error outlined below is one that also applies to other versions of plone, it happens when you don't have any answer options.
----
Hi Adam
With some trial and error I got this working as below. Great to be
able to use the product on 2.1. I like it a lot. By the way, when you
say that security needs to be improved, what do you mean by that? Also
if you wanted to gather an email address and also a phone number is
there any way these could be validated as such instead of as just
plain text?
Thanks
---------- Forwarded message ----------
From: michael nt milne <michael.milne@gmail.com>
Date: Oct 2, 2005 12:48 PM
Subject: A fix for CMFQuestions 0.4 on Plone 2.1 Windows
To: "plone-users@lists.sourceforge.net" <plone-users@lists.sourceforge.net>
Hi
I've been doing some trial and error on this using Pedro Silva's fix
for this on Plone 2.1. I tried both his code changes but got
CMFQuestions working on Windows 2.1 Python 2.3.5 Zope 2.7.7 with only
this code change. If you don't do this you get an Index out of range
error. If you change Questionnaire.py as well then you get an
attributeErrror. Just changing this line works fine. I haven't tried
this on my Unix version yet
file: questionnaire_view.pt
change: <div class="field" tal:define="hasOptions python:
len(question.getAnswerOptions()[0]) > 0">
to: <div class="field" tal:define="hasOptions python:
len(question.getAnswerOptions()) > 0">
