The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by gardnerpomper]

First, let me say that I really like this book. I first bought it to create
some basic command line python scripts, but recently we have wanted to put up
a web interface to some of the scripts. Zope, object publishing and HTML
generation seems like exactly what we need. But...

I seem to be missing something in the description in section 26.3.1 on page
333-334, where it says:

"Now when Zope publishes the index_html method of the bill object it will
return:"

I can call an external function from Zope, but not a class method, so I don't
understand how the index_html method of the bill object can be published. Did
I miss some steps? All I have been able to figure is to create another
function:

def createPerson(name,age) :
bill=Person(name,age)
return bill.index_html(bill)

but I am pretty sure that isn't what you mean. I have searched all the Zope
documentation I can find, and it hasn't helped.

Please help; I really need to do this soon, and I think I just need an example
of the DTML file that invokes the object, or the menu item in Zope which I
have to press to publish the object, or something similar.

- Gardner
import-bot (20211) [Avatar] Offline
#2
Re: Zope, object publishing and HTML generation
[Originally posted by daryl harms]

> First, let me say that I really like this book. I first bought it to create
> some basic command line python scripts, but recently we have wanted to put up
> a web interface to some of the scripts. Zope, object publishing and HTML
> generation seems like exactly what we need. But...
>
> I seem to be missing something in the description in section 26.3.1 on page
> 333-334, where it says:
>
> "Now when Zope publishes the index_html method of the bill object it will
> return:"
>
> I can call an external function from Zope, but not a class method, so I don't
> understand how the index_html method of the bill object can be published. Did
> I miss some steps? All I have been able to figure is to create another
> function:
>
> def createPerson(name,age) :
> bill=Person(name,age)
> return bill.index_html(bill)
>
> but I am pretty sure that isn't what you mean. I have searched all the Zope
> documentation I can find, and it hasn't helped.
>
> Please help; I really need to do this soon, and I think I just need an example
> of the DTML file that invokes the object, or the menu item in Zope which I
> have to press to publish the object, or something similar.
>
> - Gardner

Unfortunately, with changes in Zope as it has rapidly evolved since this
chapter was written it is no longer clear how to use the examples in this
section. Amos's
page on publishing objects should give the information you would need to
get them working:

http://www.zope.org/Members/Amos/ZPublisher

However, this is now more of an under the hood way of using Zope. You might be
better off going down the route you came up with above using external
functions or ZClasses. But look at this page and decide for yourself.

The online book dedicated to Zope that Amos is cowriting is probably your best
bet to lead you where you want to go:
http://www.zope.org/Members/michel/ZB

Daryl