Re: [Zope3-Users] formlib confusion

2006-04-06 Thread Pete Taylor
ah, hah!  that would be why no matter what i do to the template, it
doesn't change anything.  I guess, since "viewlet" takes a template
argument in zcml, i assumed it was using it.  thanks, as always, Gary.

On 4/6/06, Gary Poster <[EMAIL PROTECTED]> wrote:
>
> On Apr 6, 2006, at 7:27 PM, Alen Stanisic wrote:
>
> > Hi Pete,
> >
> > I assign templates in view classes when using formlib:
> >
> > from zope.app.pagetemplate.viewpagetemplatefile import
> > ViewPageTemplateFile
> > class ConsumerRegistrarForm(form.Form):
> > .
> > .
> > template = ViewPageTemplateFile('registrar.zpt')
> > .
> > .
>
> That's the way you do it, or with a named template, or with a custom
> render method.
>
> >
> > I would also be interested to find out if zcml template directive
> > could
> > still be used with formlib forms.
>
> Nope.  Maybe you could write a render method that looked in the right
> place; I don't remember those details anymore.
>
> Gary
>


--
"All guilt is relative, loyalty counts, and never let your conscience
be your guide."
  - Lucas Buck, American Gothic
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] formlib confusion

2006-04-06 Thread Gary Poster


On Apr 6, 2006, at 7:27 PM, Alen Stanisic wrote:


Hi Pete,

I assign templates in view classes when using formlib:

from zope.app.pagetemplate.viewpagetemplatefile import
ViewPageTemplateFile
class ConsumerRegistrarForm(form.Form):
.
.
template = ViewPageTemplateFile('registrar.zpt')
.
.


That's the way you do it, or with a named template, or with a custom  
render method.




I would also be interested to find out if zcml template directive  
could

still be used with formlib forms.


Nope.  Maybe you could write a render method that looked in the right  
place; I don't remember those details anymore.


Gary
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] formlib confusion

2006-04-06 Thread Alen Stanisic
Hi Pete,

I assign templates in view classes when using formlib:

from zope.app.pagetemplate.viewpagetemplatefile import
ViewPageTemplateFile
class ConsumerRegistrarForm(form.Form):
.
.
template = ViewPageTemplateFile('registrar.zpt')
.
.

I would also be interested to find out if zcml template directive could
still be used with formlib forms.

Alen

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
> entirely.
> 
> 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()
>   
>   @zope.cachedescriptors.property.Lazy
>   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,
>   ignore_request=ignore_request
>   )
> 
> 
> 
> 
> 
>   
>  schema="..interfaces.registration.IConsumerRegistrar"
> label="Add Consumer Registrar"
> content_factory="..registration.ConsumerRegistrar"
> name="AddConsumerRegistrar.html"
> permission="zope.ManageServices"
> />
>   
>  title="Consumer Registrar"
> description="Consumer Registrar"
> class="..registration.ConsumerRegistrar"
> permission="zope.ManageServices"
> view="AddConsumerRegistrar.html"
> />
>   
>  for="..interfaces.registration.IConsumerRegistrar"
> class=".registration.ConsumerRegistrarForm"
> template="registrar.zpt"
> name="register.html"
> permission="zope.Public"
> />
>   
>  for="..interfaces.principal.IConsumerPrincipalInfo"
> class=".registration.ConsumerRegistrarForm"
> template="registrar.zpt"
> name="register.html"
> permission="zope.Public"
> />
> 
> 
> 
> 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 :)
> Pete
> 
> --
> "All guilt is relative, loyalty counts, and never let your conscience
> be your guide."
>   - Lucas Buck, American Gothic
> ___
> Zope3-users mailing list
> Zope3-users@zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] formlib confusion

2006-04-06 Thread Pete Taylor
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
entirely.

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()

@zope.cachedescriptors.property.Lazy
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,
ignore_request=ignore_request
)





  
  

  

  

  



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 :)
Pete

--
"All guilt is relative, loyalty counts, and never let your conscience
be your guide."
  - Lucas Buck, American Gothic
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users