[Zope3-Users] Problem with z3c.form / z3c.formui packages

2008-03-14 Thread Thierry Florac
Hi,

I'm trying to use a few z3c.* packages to build a little test
application : z3c.form, z3c.formui, z3c.layout, z3c.pagelet...

What I've done until now is :
 - create a custom layer :
class ITestLayer(z3c.form.interfaces.IFormLayer,
 z3c.layer.pagelet.IPageletBrowserLayer)

 - create a custom skin based on this layer :
class ITestSkin(z3c.formui.interfaces.IDivFormLayer,
ITestLayer)

 - create a pagelet based layout for my skin (via z3c.layout)

 - create an add form, a display form and an edit form for my custom
content :
class TestAddForm(z3c.formui.form.AddForm)
class TestDisplayForm(z3c.formui.form.DisplayForm)
class TestEditForm(z3c.formui.form.EditForm)

 - declare these forms as pagelets (via z3c.pagelet)

Until now, everything is OK : I've created a set of custom widgets that
I can display without any problem in the different modes, and these
forms work perfectly.

My problem is that I would like to modify the default form template,
actually provided by z3c.formui template 'div-form.pt' ; so I've created
a new template, but I can't use it : I've tried to register it via
several ZCML directives (z3c.template...), but none of them is OK and my
custom template is never used !

So I just suppose that it's my ZCML directive which is bad, that I
missed a set of declarations (I didn't declare any macro, for example),
or just that the interface for which the template is registered is not
the good one...

Thanks for any help,
Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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


Re: [Zope3-Users] Problem with z3c.form / z3c.formui packages

2008-03-14 Thread Thierry Florac
Hi,

On ven, 2008-03-14 at 23:12 +0100, Thierry Florac wrote:
> I'm trying to use a few z3c.* packages to build a little test
> application : z3c.form, z3c.formui, z3c.layout, z3c.pagelet...
> 
> What I've done until now is :
>  - create a custom layer :
> class ITestLayer(z3c.form.interfaces.IFormLayer,
>  z3c.layer.pagelet.IPageletBrowserLayer)
> 
>  - create a custom skin based on this layer :
> class ITestSkin(z3c.formui.interfaces.IDivFormLayer,
> ITestLayer)
> 
>  - create a pagelet based layout for my skin (via z3c.layout)
> 
>  - create an add form, a display form and an edit form for my custom
> content :
> class TestAddForm(z3c.formui.form.AddForm)
> class TestDisplayForm(z3c.formui.form.DisplayForm)
> class TestEditForm(z3c.formui.form.EditForm)
> 
>  - declare these forms as pagelets (via z3c.pagelet)
> 
> Until now, everything is OK : I've created a set of custom widgets that
> I can display without any problem in the different modes, and these
> forms work perfectly.
> 
> My problem is that I would like to modify the default form template,
> actually provided by z3c.formui template 'div-form.pt' ; so I've created
> a new template, but I can't use it : I've tried to register it via
> several ZCML directives (z3c.template...), but none of them is OK and my
> custom template is never used !

I'm replying to my own message after a short discussion on IRC with
Stephan Richter, for anybody which would be interested in the answer...

The problem is coming from the ITestSkin interface, which was inheriting
from IDivFormLayer : actually, IDivFormLayer benefit is to provide a
ready to use div-based form layout ; so if your goal (like for me in
this example) is just to override this layout template, inheriting from
IDivFormLayer doesn't make any sense.

Problem was finally solved with the following statements :

class ITestSkin(z3c.formui.interfaces.IFormUILayer,ITestLayer):
...




Many thanks,
Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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


Re: [Zope3-Users] Problem with z3c.form / z3c.formui packages

2008-03-19 Thread garz

hey,

i am trying similar things, but with more basic problems.

one thing ahead:
i am very beginner, but i put very much effort in learning zope. please be a
little bit patient with me.

i have defined a layer:
class ICustomLayer(IFormLayer, Rotterdam)
using Rotterdam here, because i want to use the zmi? is that right?

class ICustomSkin(IDivFormLayer, ICustomLayer)
i use this IDivFormLayer so that i have templates for the generated forms,
because i need them because of the z3c.template package? right? i read the
readme.txt, but i still dont really know why i need this. in standard zope i
wouldnt need that.

registered the skin via zcml:



of course set the skin as default in the overrides and this works too for
sure because i already had an error there that i fixed. (havent the
zcml-line parat)

have some views for some content:
class SomeContentDisplayForm(z3c.formui.layout.FormLayoutSupport,
z3c.form.form.DisplayForm):
  fields = z3c.form.field.Fields(ISomeConcent)
class SomeContentEditForm(z3c.formui.layout.FormLayoutSupport,
z3c.form.form.EditForm):
  fields = z3c.form.field.Fields(ISomeConcent)

if i try to use the view, a componentlookuperror is raised:
IFieldWidgets cant be looked up

i thought, the errors source was the BrowserRequest, which should be marked
with the skin-type. if it was it should look up the adapter from the right
layer. so i think something is wrong with my skin registration.

could please somebody help me. i'm stuck with the problem. :(
-- 
View this message in context: 
http://www.nabble.com/Problem-with-z3c.form---z3c.formui-packages-tp16061478p16134930.html
Sent from the Zope3 - users mailing list archive at Nabble.com.

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


{Spam?} Re: [Zope3-Users] Problem with z3c.form / z3c.formui packages

2008-03-27 Thread Thierry Florac
On mer, 2008-03-19 at 06:33 -0700, garz wrote:

> have some views for some content:
> class SomeContentDisplayForm(z3c.formui.layout.FormLayoutSupport,
> z3c.form.form.DisplayForm):
>   fields = z3c.form.field.Fields(ISomeConcent)
> class SomeContentEditForm(z3c.formui.layout.FormLayoutSupport,
> z3c.form.form.EditForm):
>   fields = z3c.form.field.Fields(ISomeConcent)
> 
> if i try to use the view, a componentlookuperror is raised:
> IFieldWidgets cant be looked up
> 
> i thought, the errors source was the BrowserRequest, which should be marked
> with the skin-type. if it was it should look up the adapter from the right
> layer. so i think something is wrong with my skin registration.
> 
> could please somebody help me. i'm stuck with the problem. :(


I think I had the same problem while using z3c.form "DisplayForm"
subclass.
Problem disappeared by using an "EditForm" subclass and setting form's
mode to "DISPLAY_MODE"...

Thierry

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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


AW: {Spam?} Re: [Zope3-Users] Problem with z3c.form / z3c.formui packages

2008-03-28 Thread Roger Ineichen
Hi Thierry

> Betreff: {Spam?} Re: [Zope3-Users] Problem with z3c.form / 
> z3c.formui packages
> 
> On mer, 2008-03-19 at 06:33 -0700, garz wrote: 
> 
>   
>   have some views for some content:
>   class 
> SomeContentDisplayForm(z3c.formui.layout.FormLayoutSupport,
>   z3c.form.form.DisplayForm):
> fields = z3c.form.field.Fields(ISomeConcent)
>   class SomeContentEditForm(z3c.formui.layout.FormLayoutSupport,
>   z3c.form.form.EditForm):
> fields = z3c.form.field.Fields(ISomeConcent)
>   
>   if i try to use the view, a componentlookuperror is raised:
>   IFieldWidgets cant be looked up
>   
>   i thought, the errors source was the BrowserRequest, 
> which should be marked
>   with the skin-type. if it was it should look up the 
> adapter from the right
>   layer. so i think something is wrong with my skin registration.

Does your skin or at least one super class use IFormLayoutSupport?

>   could please somebody help me. i'm stuck with the problem. :(

Can you tell that kind of fields the schema defines?
Probably there is not widget for one of this fields configured.

Or you can check which fields makes prtobelms with using the select
filter:

fields = z3c.form.field.Fields(ISomeConcent).select('oneWidget')

Try to find the field which makes problems. And then you can
take a look if z3c.form provides a IWidget configured for that
field.

A good thing is alos debug and find out if your request really
provides the FormLayoutSupport. You can do this in the __init__
of your z3c.form class e.g.:

def __init__(self, context, request):
import pdb;pdb.set_trace()
super(MyForm, self).__init__(context, request)


Also make sure that the configure.zcml of z3c.formui
is included in your project. And you need to define the
skin with soemthing like:

  

> I think I had the same problem while using z3c.form 
> "DisplayForm" subclass.
> Problem disappeared by using an "EditForm" subclass and 
> setting form's mode to "DISPLAY_MODE"...

Seems defently a missing widget if other widget adapter will
be found for the same form.

Hope that helps

Regards
Roger Ineichen


> Thierry 
> 
> --
> This message has been scanned for viruses and dangerous 
> content by MailScanner <http://www.mailscanner.info/> , and 
> is believed to be clean. 
> 

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