Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
Hi Chris. Yeah, have been using formish for quite some time now also and endorse it as well. It is a nice library and especially like the fact that both custom and auto-generated forms are possible that provide same simplicity and convenience. The other serious benefit is that it is very small. Regards, David On 3-Oct-09, at 2:17 PM, Chris McDonough wrote: > +1 to what Martin wrote, with something else that can only add to the > confusion: recently I have been using Formish (http://ish.io) to do > autogenerated forms. I think both zope.formlib and z3c.form try to > paint forms > based on "model" objects; formish doesn't even try. It just lets > you create > your own "form schema" and attempts to draw forms based on that. > This is > enough for my needs currently. > > - C > > > Martin Aspeli wrote: >> Thomas G. Willis wrote: >>> OK, not sure if this is a blasphemous question or not. I've been >>> slowly >>> working through "Web Component Development with Zope 3" , and >>> instead of >>> trying out the things in zopeproject, I figured that trying out the >>> things in bfg as well may yield a greater understanding of what >>> the heck >>> is going on. I realize that this may be incredibly dumb, so I'm not >>> surprised that I'm hitting roadblocks once in a while. >> >> Bear in mind that whilst repoze.bfg uses a number of Zope packages, >> it >> is not built on top of Zope 3 (in the same way that, say, Grok is). >> BFG >> contains forks/re-implementations of some Zope things, omits a large >> number of package traditionally part of a Zope 3 bundle (this is a >> good >> thing!), and solves certain things differently (e.g. the way views >> are >> done in bfg is different from the way they are done in Zope). >> >> For this reason, Philipp's book will probably not apply in many >> cases if >> you're using BFG, and I don't think there's any documentation or good >> guides to *which* parts will apply and which parts won't (i.e. a "bfg >> delta zope" document). >> >> That said, I can't see it being impossible to use zope.schema + a >> forms >> library in repoze.bfg. Not that I've tried. ;) >> >>> After reading up on zope.schema and zope.formlib, it seems that >>> schema >>> based forms, fit my brain, and I would like to use them in bfg if >>> possible rather than tw.forms etc... >> >> This won't help with your specific question, but most people seem >> to be >> ditching zope.formlib in favour of z3c.form, which is more feature >> complete, better documented and better maintained. The basic >> principles >> are still the same: you build a schema and then create a form from >> that >> schema. >> >> http://docs.zope.org/z3c.form has the documentation. >> >> To use it, you need to depend on it in your own package's setup.py so >> that it gets installed, and include its configuration via > package="z3c.form" /> in your configure.zcml. To use the default >> widgets >> (which you probably want) you also need to mark the request with the >> IFormLayer marker interface. I'm not sure what facility repoze.bfg >> has >> for that, though. >> >> Martin >> > > ___ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
Hi Chris, Chris McDonough wrote: > Form generation libraries that contain validation are very tough to > generalize > in a way that lends itself to framework convenience. I think Formish does a > pretty good job here, because it physically separates out a lot of stuff > that's > all glommed together in other system (and thus there's schemish, validatish, > convertish, and even 'dottedish'). It's shows maturity in design. ish :p > But at its very outer layer it *does* depend on the request having a > particular > API (the WebOb API). But so does BFG, so this works out pretty well. Right, and that's probably a good thing. It's really hard to abstract away from something as fundamental as the request in a meaningful way. WebOb serves an important role here in being a cross-framework implementation. > I suspect it will be a bit of a project to use anything that depends on a > particular request API but doesn't depend on the WebOb API. Yeah. You'd probably need to write an adapter to the Zope IBrowserRequest interface or something like that, and hook in the code to actually look up the adapter prior to anything "formish" happening in z3c.form (or zope.formlib). > So I have the beginnings of BFG-ish bindings for Formish here (unfinished and > very unstable; the docs are currently total bollocks and don't match the > implementation): > > http://svn.repoze.org/repoze.bfg.formish/trunk/ > > I hope to have a release of this out within the next few weeks. Sounds great! From a quick scan, formish looks like a good form implementation for WebOb based frameworks. And ironically, I say that because it looks a bit like z3c.form. ;-) Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
Martin Aspeli wrote: > Thomas G. Willis wrote: > >> I was kind of expecting that the book would have some gaps as far as bfg >> goes. I was hoping that going through the exercise of struggling through >> those gaps would help me arrive at a better understanding of all things >> zope(a lofty goal I'm sure). > > I guess what I was saying that BFG is more "inspired by" Zope than > actually based on it. It does use a number of low-level Zope packages, > but it doesn't try to be consistent with "Zopeish" ways of doing things. That's about right. > One good example is the way that views work. In Zope, you register a > view factory (usually a class). The publisher will invoke the factory, > and then call the result (usually). Therefore, a basic view is a class > that takes two parameters in __init__, the context and the request, and > has a __call__ method that returns a string (or renders a template). > > In BFG, a view is a method that gets called, i.e. the factory bit is > lost. If that's good or bad probably depends on your point of view. It's > certainly simpler. ;) This is a bit off topic, but BFG actually also supports the "view as a class" view construction form, ala Zope: http://docs.repoze.org/bfg/1.1/narr/views.html#defining-a-view-as-a-class The form is overkill for lots of common things, so we also support the notion that a view can also just be a callable. >> thanks so much for the info. I'll check out z3c.form. >> >> But if I understand what you are saying about the request needing to be >> marked with the IFormLayer interface, I would assume an adapter could be >> configured to provide that. I'll try that first anyway. > > I can tell you how to do it in Plone. ;-) > > I'm sure repoze.bfg has a simple way to hook in an event handler to do > this. You basically want: > >from zope.interface import alsoProvides >from z3c.form.interfaces import IFormLayer > >alsoProvides(request, IFormLayer) You could try to mess around with an INewRequest event subscriber, ala: http://docs.repoze.org/bfg/1.1/narr/events.html#using-an-event-to-vary-the-request-type > The question is where the request comes from, and what kind of an object > it is. A Zope 3 request (from the zope.publisher package) is different > from a BFG request, as far as I understand. So, it may be that z3c.form > would require some kind of a "zopeish" request adapter to even work. Figuring out the real difference here would be 99% of the work in making it work, I imagine. > > The same would be true of zope.formlib, of course. I suspect you may be > the first person to try this, though. If you're also just learning, then > maybe that's making life very hard for yourself. > > My advice would be to read Philipp's book because it's very good and > will teach you a bunch of stuff about Zope. If you like the way it > works, take a look also at grok.zope.org, which uses all the Zope stuff > underneath but aims to make it easier to get started through > convention-over-configuration. > > At the same time (or before or after) read the bfg docs on > bfg.repoze.org. They're very good too. But I'd maybe try to keep > repoze.bfg and "Zope" (at least as far as Philipp's book goes) separate > in your mind until you become more proficient with both and understand > them well enough to be able to help integrate Zope technologies into BFG > or vice-a-versa. ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
Form generation libraries that contain validation are very tough to generalize in a way that lends itself to framework convenience. I think Formish does a pretty good job here, because it physically separates out a lot of stuff that's all glommed together in other system (and thus there's schemish, validatish, convertish, and even 'dottedish'). It's shows maturity in design. But at its very outer layer it *does* depend on the request having a particular API (the WebOb API). But so does BFG, so this works out pretty well. I suspect it will be a bit of a project to use anything that depends on a particular request API but doesn't depend on the WebOb API. So I have the beginnings of BFG-ish bindings for Formish here (unfinished and very unstable; the docs are currently total bollocks and don't match the implementation): http://svn.repoze.org/repoze.bfg.formish/trunk/ I hope to have a release of this out within the next few weeks. Martin Aspeli wrote: > Chris McDonough wrote: >> +1 to what Martin wrote, with something else that can only add to the >> confusion: recently I have been using Formish (http://ish.io) to do >> autogenerated forms. I think both zope.formlib and z3c.form try to paint >> forms >> based on "model" objects; formish doesn't even try. It just lets you create >> your own "form schema" and attempts to draw forms based on that. This is >> enough for my needs currently. > > > From a quick read of the documentation, formish looks nice. It also > looks very similar to z3c.form, and has many of the same abstractions > (fields, widgets, form renderers, data converters). > > z3c.form indeed contains some base classes for "model-based" > add/edit/display forms, but it's easy to base it on anything (you don't > even need an interface, you can just pass it a sequence of schema fields). > > In this regard, z3c.form is at least a lot more flexible than zope.formlib. > > Martin > > ___ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev > ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
Thomas G. Willis wrote: > I was kind of expecting that the book would have some gaps as far as bfg > goes. I was hoping that going through the exercise of struggling through > those gaps would help me arrive at a better understanding of all things > zope(a lofty goal I'm sure). I guess what I was saying that BFG is more "inspired by" Zope than actually based on it. It does use a number of low-level Zope packages, but it doesn't try to be consistent with "Zopeish" ways of doing things. One good example is the way that views work. In Zope, you register a view factory (usually a class). The publisher will invoke the factory, and then call the result (usually). Therefore, a basic view is a class that takes two parameters in __init__, the context and the request, and has a __call__ method that returns a string (or renders a template). In BFG, a view is a method that gets called, i.e. the factory bit is lost. If that's good or bad probably depends on your point of view. It's certainly simpler. ;) > thanks so much for the info. I'll check out z3c.form. > > But if I understand what you are saying about the request needing to be > marked with the IFormLayer interface, I would assume an adapter could be > configured to provide that. I'll try that first anyway. I can tell you how to do it in Plone. ;-) I'm sure repoze.bfg has a simple way to hook in an event handler to do this. You basically want: from zope.interface import alsoProvides from z3c.form.interfaces import IFormLayer alsoProvides(request, IFormLayer) The question is where the request comes from, and what kind of an object it is. A Zope 3 request (from the zope.publisher package) is different from a BFG request, as far as I understand. So, it may be that z3c.form would require some kind of a "zopeish" request adapter to even work. The same would be true of zope.formlib, of course. I suspect you may be the first person to try this, though. If you're also just learning, then maybe that's making life very hard for yourself. My advice would be to read Philipp's book because it's very good and will teach you a bunch of stuff about Zope. If you like the way it works, take a look also at grok.zope.org, which uses all the Zope stuff underneath but aims to make it easier to get started through convention-over-configuration. At the same time (or before or after) read the bfg docs on bfg.repoze.org. They're very good too. But I'd maybe try to keep repoze.bfg and "Zope" (at least as far as Philipp's book goes) separate in your mind until you become more proficient with both and understand them well enough to be able to help integrate Zope technologies into BFG or vice-a-versa. Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
Chris McDonough wrote: > +1 to what Martin wrote, with something else that can only add to the > confusion: recently I have been using Formish (http://ish.io) to do > autogenerated forms. I think both zope.formlib and z3c.form try to paint > forms > based on "model" objects; formish doesn't even try. It just lets you create > your own "form schema" and attempts to draw forms based on that. This is > enough for my needs currently. From a quick read of the documentation, formish looks nice. It also looks very similar to z3c.form, and has many of the same abstractions (fields, widgets, form renderers, data converters). z3c.form indeed contains some base classes for "model-based" add/edit/display forms, but it's easy to base it on anything (you don't even need an interface, you can just pass it a sequence of schema fields). In this regard, z3c.form is at least a lot more flexible than zope.formlib. Martin ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
> > Hey Martin, > I was kind of expecting that the book would have some gaps as far as > bfg goes. I was hoping that going through the exercise of struggling > through those gaps would help me arrive at a better understanding of > all things zope(a lofty goal I'm sure). > > > thanks so much for the info. I'll check out z3c.form. > > But if I understand what you are saying about the request needing to > be marked with the IFormLayer interface, I would assume an adapter > could be configured to provide that. I'll try that first anyway. Martin probably won't toot his own horn, but I actually found the zope chapters in his book very helpful for understanding the zca and while there is a lot of stuff that is different, my understanding of what I can do with bfg and how to use other zope bits has been greatly improved by reading both Phillips book and Martin's 'Professional Plone Development.' The chapter on Zope foundations and the ZCA is especially good. Iain ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
Just a couple of comments on your bigger picture questions: > > #1 does bfg provide machinery for registering components or is that > functionality specific to big daddy zope? I assume the answer is yes, > augmented with "it depends". I realize that bfg is meant to isolate you > from the zca, but darn it I think it's cool and I want to understand how > it's used. The above referenced book doesn't have any obvious section that > details how this works, at least not that I've found, so if anyone knows of > an online resource on how this works. I'd appreciate knowing about it. > BFG is not meant to isolate you from the ZCA, it just doesn't force you to use it. If you are using zope.component, zope.interface and zope.schema, you can perform whatever registrations you want in BFG. This *is* the ZCA. Formlib is just a library that uses it. You may probably find this useful: http://www.muthukadan.net/docs/zca.html > #2 is the fact that an easy_install off zope.formlib results in no out of > the box zcml file to include (as far as I can tell) a result of these > particular zope libs not being refactored to be more standalone-ish? If so, > what would generally be the process of making it more standalone-ish. Would > it just be coming up with some configure.zcml to deploy with the package? > Many zope libraries can be used easily in BFG. In the case of formlib, the library itself is too tied to the 'zope as application' side of things. For example, widgets are adapters for the schema field and the zope request, but since BFG uses the WebOb request, you just won't be able to use it, no matter if you include the correct .zcml file (which actually was at zope.app.from.browser). The sad truth is zope is very componentized, but many components expect that a zope developer will use all of them anyway. I hope this does not result in still more confusion for you. Carlos de la Guardia ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
I actually looked at this yesterday and it didn't seem to generate forms but does provide the marshaling + validation. so it seems to me it's similar to formencode/htmlfill, where I'm looking for something more like tw.forms. On Sat, Oct 3, 2009 at 2:35 PM, Andreas Reuleaux wrote: > You might also want to look at Malte's repoze.formapi, > see e. g. his blog entry > > > http://mockit.blogspot.com/2009/05/forms-that-dont-make-you-tense-and.html > > Personally I can't comment on repoze.formapi vs. formish, as I have > used neither of them yet, but I think both should work well with bfg, > whereas z3c.form would require some porting effort. > > -Andreas > > > On Sat, Oct 03, 2009 at 01:17:21PM -0400, Chris McDonough wrote: > > +1 to what Martin wrote, with something else that can only add to the > > confusion: recently I have been using Formish (http://ish.io) to do > > autogenerated forms. I think both zope.formlib and z3c.form try to paint > forms > > based on "model" objects; formish doesn't even try. It just lets you > create > > your own "form schema" and attempts to draw forms based on that. This is > > enough for my needs currently. > > > > - C > > > > > > Martin Aspeli wrote: > > > Thomas G. Willis wrote: > > >> OK, not sure if this is a blasphemous question or not. I've been > slowly > > >> working through "Web Component Development with Zope 3" , and instead > of > > >> trying out the things in zopeproject, I figured that trying out the > > >> things in bfg as well may yield a greater understanding of what the > heck > > >> is going on. I realize that this may be incredibly dumb, so I'm not > > >> surprised that I'm hitting roadblocks once in a while. > > > > > > Bear in mind that whilst repoze.bfg uses a number of Zope packages, it > > > is not built on top of Zope 3 (in the same way that, say, Grok is). BFG > > > contains forks/re-implementations of some Zope things, omits a large > > > number of package traditionally part of a Zope 3 bundle (this is a good > > > thing!), and solves certain things differently (e.g. the way views are > > > done in bfg is different from the way they are done in Zope). > > > > > > For this reason, Philipp's book will probably not apply in many cases > if > > > you're using BFG, and I don't think there's any documentation or good > > > guides to *which* parts will apply and which parts won't (i.e. a "bfg > > > delta zope" document). > > > > > > That said, I can't see it being impossible to use zope.schema + a forms > > > library in repoze.bfg. Not that I've tried. ;) > > > > > >> After reading up on zope.schema and zope.formlib, it seems that schema > > >> based forms, fit my brain, and I would like to use them in bfg if > > >> possible rather than tw.forms etc... > > > > > > This won't help with your specific question, but most people seem to be > > > ditching zope.formlib in favour of z3c.form, which is more feature > > > complete, better documented and better maintained. The basic principles > > > are still the same: you build a schema and then create a form from that > > > schema. > > > > > > http://docs.zope.org/z3c.form has the documentation. > > > > > > To use it, you need to depend on it in your own package's setup.py so > > > that it gets installed, and include its configuration via > > package="z3c.form" /> in your configure.zcml. To use the default > widgets > > > (which you probably want) you also need to mark the request with the > > > IFormLayer marker interface. I'm not sure what facility repoze.bfg has > > > for that, though. > > > > > > Martin > > > > > > > ___ > > Repoze-dev mailing list > > Repoze-dev@lists.repoze.org > > http://lists.repoze.org/listinfo/repoze-dev > ___ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev > -- Thomas G. Willis ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
:) I'll have to try this out too. That sounds like exactly what I'm looking for. On Sat, Oct 3, 2009 at 1:17 PM, Chris McDonough wrote: > +1 to what Martin wrote, with something else that can only add to the > confusion: recently I have been using Formish (http://ish.io) to do > autogenerated forms. I think both zope.formlib and z3c.form try to paint > forms > based on "model" objects; formish doesn't even try. It just lets you > create > your own "form schema" and attempts to draw forms based on that. This is > enough for my needs currently. > > - C > > > Martin Aspeli wrote: > > Thomas G. Willis wrote: > >> OK, not sure if this is a blasphemous question or not. I've been slowly > >> working through "Web Component Development with Zope 3" , and instead of > >> trying out the things in zopeproject, I figured that trying out the > >> things in bfg as well may yield a greater understanding of what the heck > >> is going on. I realize that this may be incredibly dumb, so I'm not > >> surprised that I'm hitting roadblocks once in a while. > > > > Bear in mind that whilst repoze.bfg uses a number of Zope packages, it > > is not built on top of Zope 3 (in the same way that, say, Grok is). BFG > > contains forks/re-implementations of some Zope things, omits a large > > number of package traditionally part of a Zope 3 bundle (this is a good > > thing!), and solves certain things differently (e.g. the way views are > > done in bfg is different from the way they are done in Zope). > > > > For this reason, Philipp's book will probably not apply in many cases if > > you're using BFG, and I don't think there's any documentation or good > > guides to *which* parts will apply and which parts won't (i.e. a "bfg > > delta zope" document). > > > > That said, I can't see it being impossible to use zope.schema + a forms > > library in repoze.bfg. Not that I've tried. ;) > > > >> After reading up on zope.schema and zope.formlib, it seems that schema > >> based forms, fit my brain, and I would like to use them in bfg if > >> possible rather than tw.forms etc... > > > > This won't help with your specific question, but most people seem to be > > ditching zope.formlib in favour of z3c.form, which is more feature > > complete, better documented and better maintained. The basic principles > > are still the same: you build a schema and then create a form from that > > schema. > > > > http://docs.zope.org/z3c.form has the documentation. > > > > To use it, you need to depend on it in your own package's setup.py so > > that it gets installed, and include its configuration via > package="z3c.form" /> in your configure.zcml. To use the default widgets > > (which you probably want) you also need to mark the request with the > > IFormLayer marker interface. I'm not sure what facility repoze.bfg has > > for that, though. > > > > Martin > > > > ___ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev > -- Thomas G. Willis ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
You might also want to look at Malte's repoze.formapi, see e. g. his blog entry http://mockit.blogspot.com/2009/05/forms-that-dont-make-you-tense-and.html Personally I can't comment on repoze.formapi vs. formish, as I have used neither of them yet, but I think both should work well with bfg, whereas z3c.form would require some porting effort. -Andreas On Sat, Oct 03, 2009 at 01:17:21PM -0400, Chris McDonough wrote: > +1 to what Martin wrote, with something else that can only add to the > confusion: recently I have been using Formish (http://ish.io) to do > autogenerated forms. I think both zope.formlib and z3c.form try to paint > forms > based on "model" objects; formish doesn't even try. It just lets you create > your own "form schema" and attempts to draw forms based on that. This is > enough for my needs currently. > > - C > > > Martin Aspeli wrote: > > Thomas G. Willis wrote: > >> OK, not sure if this is a blasphemous question or not. I've been slowly > >> working through "Web Component Development with Zope 3" , and instead of > >> trying out the things in zopeproject, I figured that trying out the > >> things in bfg as well may yield a greater understanding of what the heck > >> is going on. I realize that this may be incredibly dumb, so I'm not > >> surprised that I'm hitting roadblocks once in a while. > > > > Bear in mind that whilst repoze.bfg uses a number of Zope packages, it > > is not built on top of Zope 3 (in the same way that, say, Grok is). BFG > > contains forks/re-implementations of some Zope things, omits a large > > number of package traditionally part of a Zope 3 bundle (this is a good > > thing!), and solves certain things differently (e.g. the way views are > > done in bfg is different from the way they are done in Zope). > > > > For this reason, Philipp's book will probably not apply in many cases if > > you're using BFG, and I don't think there's any documentation or good > > guides to *which* parts will apply and which parts won't (i.e. a "bfg > > delta zope" document). > > > > That said, I can't see it being impossible to use zope.schema + a forms > > library in repoze.bfg. Not that I've tried. ;) > > > >> After reading up on zope.schema and zope.formlib, it seems that schema > >> based forms, fit my brain, and I would like to use them in bfg if > >> possible rather than tw.forms etc... > > > > This won't help with your specific question, but most people seem to be > > ditching zope.formlib in favour of z3c.form, which is more feature > > complete, better documented and better maintained. The basic principles > > are still the same: you build a schema and then create a form from that > > schema. > > > > http://docs.zope.org/z3c.form has the documentation. > > > > To use it, you need to depend on it in your own package's setup.py so > > that it gets installed, and include its configuration via > package="z3c.form" /> in your configure.zcml. To use the default widgets > > (which you probably want) you also need to mark the request with the > > IFormLayer marker interface. I'm not sure what facility repoze.bfg has > > for that, though. > > > > Martin > > > > ___ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
On Sat, Oct 3, 2009 at 12:35 PM, Martin Aspeli > wrote: > Thomas G. Willis wrote: > > OK, not sure if this is a blasphemous question or not. I've been slowly > > working through "Web Component Development with Zope 3" , and instead of > > trying out the things in zopeproject, I figured that trying out the > > things in bfg as well may yield a greater understanding of what the heck > > is going on. I realize that this may be incredibly dumb, so I'm not > > surprised that I'm hitting roadblocks once in a while. > > Bear in mind that whilst repoze.bfg uses a number of Zope packages, it > is not built on top of Zope 3 (in the same way that, say, Grok is). BFG > contains forks/re-implementations of some Zope things, omits a large > number of package traditionally part of a Zope 3 bundle (this is a good > thing!), and solves certain things differently (e.g. the way views are > done in bfg is different from the way they are done in Zope). > > For this reason, Philipp's book will probably not apply in many cases if > you're using BFG, and I don't think there's any documentation or good > guides to *which* parts will apply and which parts won't (i.e. a "bfg > delta zope" document). > > That said, I can't see it being impossible to use zope.schema + a forms > library in repoze.bfg. Not that I've tried. ;) > > > After reading up on zope.schema and zope.formlib, it seems that schema > > based forms, fit my brain, and I would like to use them in bfg if > > possible rather than tw.forms etc... > > This won't help with your specific question, but most people seem to be > ditching zope.formlib in favour of z3c.form, which is more feature > complete, better documented and better maintained. The basic principles > are still the same: you build a schema and then create a form from that > schema. > > http://docs.zope.org/z3c.form has the documentation. > > To use it, you need to depend on it in your own package's setup.py so > that it gets installed, and include its configuration via package="z3c.form" /> in your configure.zcml. To use the default widgets > (which you probably want) you also need to mark the request with the > IFormLayer marker interface. I'm not sure what facility repoze.bfg has > for that, though. > > Martin > > -- > Author of `Professional Plone Development`, a book for developers who > want to work with Plone. See http://martinaspeli.net/plone-book > > ___ > Repoze-dev mailing list > Repoze-dev@lists.repoze.org > http://lists.repoze.org/listinfo/repoze-dev > Hey Martin, I was kind of expecting that the book would have some gaps as far as bfg goes. I was hoping that going through the exercise of struggling through those gaps would help me arrive at a better understanding of all things zope(a lofty goal I'm sure). thanks so much for the info. I'll check out z3c.form. But if I understand what you are saying about the request needing to be marked with the IFormLayer interface, I would assume an adapter could be configured to provide that. I'll try that first anyway. -- Thomas G. Willis ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
+1 to what Martin wrote, with something else that can only add to the confusion: recently I have been using Formish (http://ish.io) to do autogenerated forms. I think both zope.formlib and z3c.form try to paint forms based on "model" objects; formish doesn't even try. It just lets you create your own "form schema" and attempts to draw forms based on that. This is enough for my needs currently. - C Martin Aspeli wrote: > Thomas G. Willis wrote: >> OK, not sure if this is a blasphemous question or not. I've been slowly >> working through "Web Component Development with Zope 3" , and instead of >> trying out the things in zopeproject, I figured that trying out the >> things in bfg as well may yield a greater understanding of what the heck >> is going on. I realize that this may be incredibly dumb, so I'm not >> surprised that I'm hitting roadblocks once in a while. > > Bear in mind that whilst repoze.bfg uses a number of Zope packages, it > is not built on top of Zope 3 (in the same way that, say, Grok is). BFG > contains forks/re-implementations of some Zope things, omits a large > number of package traditionally part of a Zope 3 bundle (this is a good > thing!), and solves certain things differently (e.g. the way views are > done in bfg is different from the way they are done in Zope). > > For this reason, Philipp's book will probably not apply in many cases if > you're using BFG, and I don't think there's any documentation or good > guides to *which* parts will apply and which parts won't (i.e. a "bfg > delta zope" document). > > That said, I can't see it being impossible to use zope.schema + a forms > library in repoze.bfg. Not that I've tried. ;) > >> After reading up on zope.schema and zope.formlib, it seems that schema >> based forms, fit my brain, and I would like to use them in bfg if >> possible rather than tw.forms etc... > > This won't help with your specific question, but most people seem to be > ditching zope.formlib in favour of z3c.form, which is more feature > complete, better documented and better maintained. The basic principles > are still the same: you build a schema and then create a form from that > schema. > > http://docs.zope.org/z3c.form has the documentation. > > To use it, you need to depend on it in your own package's setup.py so > that it gets installed, and include its configuration via package="z3c.form" /> in your configure.zcml. To use the default widgets > (which you probably want) you also need to mark the request with the > IFormLayer marker interface. I'm not sure what facility repoze.bfg has > for that, though. > > Martin > ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] zope.schema, zope.formlib in bfg? or help a newb understand zca coolness
Thomas G. Willis wrote: > OK, not sure if this is a blasphemous question or not. I've been slowly > working through "Web Component Development with Zope 3" , and instead of > trying out the things in zopeproject, I figured that trying out the > things in bfg as well may yield a greater understanding of what the heck > is going on. I realize that this may be incredibly dumb, so I'm not > surprised that I'm hitting roadblocks once in a while. Bear in mind that whilst repoze.bfg uses a number of Zope packages, it is not built on top of Zope 3 (in the same way that, say, Grok is). BFG contains forks/re-implementations of some Zope things, omits a large number of package traditionally part of a Zope 3 bundle (this is a good thing!), and solves certain things differently (e.g. the way views are done in bfg is different from the way they are done in Zope). For this reason, Philipp's book will probably not apply in many cases if you're using BFG, and I don't think there's any documentation or good guides to *which* parts will apply and which parts won't (i.e. a "bfg delta zope" document). That said, I can't see it being impossible to use zope.schema + a forms library in repoze.bfg. Not that I've tried. ;) > After reading up on zope.schema and zope.formlib, it seems that schema > based forms, fit my brain, and I would like to use them in bfg if > possible rather than tw.forms etc... This won't help with your specific question, but most people seem to be ditching zope.formlib in favour of z3c.form, which is more feature complete, better documented and better maintained. The basic principles are still the same: you build a schema and then create a form from that schema. http://docs.zope.org/z3c.form has the documentation. To use it, you need to depend on it in your own package's setup.py so that it gets installed, and include its configuration via in your configure.zcml. To use the default widgets (which you probably want) you also need to mark the request with the IFormLayer marker interface. I'm not sure what facility repoze.bfg has for that, though. Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev