#3 — ZPTField cannot have a storage type of AnnotationStorage

by Allen Thomerson last modified Feb 21, 2009 10:05 PM
State Unconfirmed
Version: 1.1.3
Area General
Issue type Bug
Severity Medium
Submitted by Allen Thomerson
Submitted on Feb 15, 2009
Responsible
Target release:
If you define a ZPTField as having a storage type of AnnotationStorage rendering the field will fail with a message like the following:
Failed example:
    registration1.getEmailResponse(**{'registrant':registrant1})
Exception raised:
    Traceback (most recent call last):
      File "C:\dojo/zope2\lib\python\zope\testing\doctest.py", line 1348, in __r
un
        compileflags, 1) in test.globs
      File "<doctest registration.txt[19]>", line 1, in ?
        registration1.getEmailResponse(**{'registrant':registrant1})
      File "c:\dojo\buildout-cache\eggs\products.archetypes-1.5.10-py2.4.egg\Pro
ducts\Archetypes\ClassGen.py", line 56, in generatedAccessor
        return schema[name].get(self, **kw)
      File "c:\dojo\buildout-cache\eggs\products.templatefields-1.2-py2.4.egg\Pr
oducts\TemplateFields\_field.py", line 123, in get
        return value.pt_render(extra_context={'options': kwargs})
      File "C:\dojo/zope2\lib\python\Products\PageTemplates\ZopePageTemplate.py"
, line 427, in pt_render
        result = PageTemplate.pt_render(self, source, extra_context)
      File "C:\dojo/zope2\lib\python\Products\PageTemplates\PageTemplate.py", li
ne 87, in pt_render
        c = self.pt_getContext()
      File "C:\dojo/zope2\lib\python\Products\PageTemplates\ZopePageTemplate.py"
, line 274, in pt_getContext
        root = self.getPhysicalRoot()
    TypeError: 'str' object is not callable

Steps to reproduce:
in Products.TemplateFields.config set CATCH_RENDER_ERRORS to False
create a ZPTField in your content type as follows:
    ZPTField(
        name="email_response",
        schemata="thank_you",
        storage = atapi.AnnotationStorage(),
        required=True,
        accessor="getEmailResponse",
        default_output_type = 'text/plain',
        #searchable=1,
        default=DEFAULT_EMAIL_RESPONSE,
        widget=atapi.TextAreaWidget(
            label=_(u"Email response message"),
            visible={'edit':'visible', 'view':'invisible'},
            description=_(u"Email message text that is returned to registrant. This template is rendered in context of Registration. Current registrant object is available through 'options/registrant'."),
            rows=10,
        ),
    ),

No responses can be added.