I assign templates in view classes when using formlib:
from zope.app.pagetemplate.viewpagetemplatefile import
template = ViewPageTemplateFile('registrar.zpt')
I would also be interested to find out if zcml template directive could
still be used with formlib forms.
On Thu, 2006-04-06 at 10:41 -0400, Pete Taylor wrote:
> hi all... i've recently tried to start moving away from
> zope.app.form.browser.editview's EditView, and to zope.formlib.form's
> Form and EditForm, but have run into something that confuses me.
> i'm setting up the zcml for both of them basically the same way, using
> browser:page and assigning a template. my issue is that it doesn't
> seem like EditForm is paying any attention to my page template. no
> matter what i do to the page template, nothing changes in the display,
> but if i remove the page template entirely, i get a system error
> saying it can't find the resource, just like i'd expect.
> so the machinery is aware of the page template, but seems to ignore it
> my class looks something like the following... the actions are just
> placeholders until i figure out why the page template doesn't seem to
> have any affect.
> class ConsumerRegistrarForm(form.Form):
> """form to be filled out at signup"""
> form_fields = form.Fields(IConsumerRegistrar,
> IConsumerPrincipalInfo, omit_readonly=True)
> primary_actions = form.Actions()
> secondary_actions = form.Actions()
> def actions(self):
> return list(self.primary_actions) + list(self.secondary_actions)
> @form.action(u'Register', primary_actions)
> def handle_registration_action(self, action, data):
> self.status = u"You clicked the button!"
> @form.action(u'SomethingElse', secondary_actions)
> def handle_somethingelse_action(self, action, data):
> self.status = u'This does nothing!'
> def setUpWidgets(self, ignore_request=False):
> self.widgets = form.setUpWidgets(
> self.form_fields, self.prefix, self.context, self.request,
> <!-- consumer registar -->
> label="Add Consumer Registrar"
> title="Consumer Registrar"
> description="Consumer Registrar"
> any thoughts on this would be very appreciated... my original page
> template was so simple that i didn't notice it wasn't having any
> affect. but once i started adding viewlets to it that didn't show up
> in view source at all, i realized something was amiss. i deleted
> everything except the bare skeleton, including all metal:use-macro
> statements in my page template, and still, the view kept showing up
> exactly the same way. even just making it blank html that said "I am
> the page template!" for the body didn't make any difference to the
> view, which makes me think it's paying no attention to it at all.
> Thanks, as always :)
> "All guilt is relative, loyalty counts, and never let your conscience
> be your guide."
> - Lucas Buck, American Gothic
> Zope3-users mailing list
Zope3-users mailing list