[Zope3-Users] Still trying am to build an EditForm
Andreas Reuleaux
reuleaux at web.de
Sun Sep 2 21:43:34 EDT 2007
Hi Florian,
I have been playing with your example, try this:
download http://user.cs.tu-berlin.de/~reuleaux/blogs.tgz
unpack and cd into blogs
edit buildout.cfg as you see fit: especially the eggs-directory
should be changed, right now: /home/reuleaux/z3eggs
$ python bootstrap.py
$ ./bin/buildout
$ ./bin/instance start|stop|restart|debug
then goto: localhost:8080
you can e. g. add a folder there, say foo (but you don't have to)
the use the My skin:
http://localhost:8080/++skin++My/foo
there you can add blog entries, edit them, see the list of all entries,
there is some navigation bar on the left.
Basically this is a mixture of
* the addressbook-example of formdemo
* your interface defs
* Baiju's blog for zc.buildout example
* some of my own stuff, that I learnt from z3c.form so far
some points to note:
* somewhere in a template I was having difficulties with
widget/content -> therefore changed to cntnt
* there are some Makefiles in there that allow you to clean up
- in the current folder with: make clean
- recursively with: make rclean
* the example really needs some cleanup
- lot's of pkgs not needed
- forms could certainly be used smarter: e g.
I wanted a DisplayForm with a change button -> I used form.Form
however it works for me.
hope this helps.
-Andreas
On Sun, Sep 02, 2007 at 09:39:56PM +0200, Florian Lindner wrote:
> Hello,
> I am still trying to build an EditForm using z3c.form. Since my previous
> thread is rather old I dare to open a new one.
>
> I've tried a number of variations and will post the one which is the closest
> to the example.
>
> This is the interface:
>
> class IBlogEntry(IContainer):
> """Interface for blog entry objects."""
> contains(IBlogComment)
>
> title = TextLine(
> title = _(u"Blog entry title"),
> description = _(u"Blog entry title."),
> default = u"",
> required = True)
>
> content = Text(
> title = _(u"Blog entry content"),
> description = _(u"Blog entry content."),
> default = u"",
> required = True)
>
> inputType = Choice(
> title = _(u"Type of input"),
> description = _(u"Specify the input type"),
> required = True,
> default = u"reStructeredText",
> values = [u"reStructeredText", u"HTML"] )
>
> The view is configured like that:
>
> <z3c:pagelet
> name="EditEntry.html"
> for="..interfaces.IBlogEntry"
> class=".views.EditEntry"
> permission="Blog.EditEntry"
> layer="Blog.interfaces.IBlogLayer"
> />
>
> The code in .views.EditEntry is:
>
> class EditEntry(layout.FormLayoutSupport, form.EditForm):
> fields = field.Fields(IBlogEntry).select("title", "content")
>
> The layer is registered like that:
>
> <interface
> interface=".interfaces.IBlogLayer"
> name="BlogSkin"
> type="zope.publisher.interfaces.browser.IBrowserSkinType"
> />
>
> and
>
> class IBlogLayer(IFormLayer, IPageletBrowserLayer):
> """Demo browser layer using div-form layout template."""
>
>
> Now I call the URL.
>
> http://localhost:8080/++skin++BlogSkin/Blog/2007_08_16_abc/EditEntry
>
> 2007_08_16_abc ist an BlogEntry object.
>
> Now there comes an "ComponentLookupError. A server error occurred. " up.
>
> Traceback (most recent call last):
> Module zope.publisher.publish, line 133, in publish
> result = publication.callObject(request, obj)
> Module zope.app.publication.zopepublication, line 167, in callObject
> return mapply(ob, request.getPositionalArguments(), request)
> Module zope.publisher.publish, line 108, in mapply
> return debug_call(obj, args)
> - __traceback_info__: <security proxied z3c.pagelet.zcml.EditEntry instance
> at 0xa0248cc>
> Module zope.publisher.publish, line 114, in debug_call
> return obj(*args)
> Module z3c.formui.layout, line 27, in __call__
> ILayoutTemplate)
> Module zope.component._api, line 103, in getMultiAdapter
> raise ComponentLookupError(objects, interface, name)
> ComponentLookupError: ((<z3c.pagelet.zcml.EditEntry object at 0xa0248cc>,
> <zope.publisher.browser.BrowserRequest instance
> URL=http://localhost:8080/++skin++BlogSkin/Blog/2007_08_16_abc/EditEntry.html>),
> <InterfaceClass z3c.template.interfaces.ILayoutTemplate>, u'')
>
>
> I have also tried some variations of the above like not using z3c:pagelet but
> an normal page directive, registered it without an layer directive and so on.
>
> So please... whats wrong there?
>
> Thanks,
>
> Florian
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
>
> !DSPAM:46db201184319549218874!
More information about the Zope3-users
mailing list