hi all, <Newbie alert blaring> i'm messing around with Boring product, and now wants to do more. i have problems when i got more than one class in a product. this is what i wanted to do. create a guestbook (what else :)) product. GB.py with two classes - GB and GBitem. i can now load GB product, but can't add GBitem. what do i need to do to get the 'Add' selection box? GB.py is available at http://203.106.2.206:8080/Tmp/GB help, pointers, docs appreciated thabks -- ------------------------------------------------------ http://www.kedai.com.my/kk Am I Evil?
You don't show the __init__.py file so it's hard to be sure, but... Did you register the class? Here's the class registration from ZScheduler http://www.zope.org/Members/lstaffor/ZScheduler # register ZEvent class try: context.registerClass( ZEvent.OneTimeZEvent, permission = 'Add ZEvent', constructors = ( ZEvent.manage_addOneTimeZEventForm, ZEvent.manage_addOneTimeZEvent), icon = 'www/OneTimeZEvent.gif') context.registerBaseClass(ZEvent.OneTimeZEvent) except: # if you can't register the class, tell someone. loggerr(200, 'Failed to register ZEvent class.') import sys, traceback, string type, val, tb = sys.exc_info() sys.stderr.write(string.join( traceback.format_exception(type, val, tb), '')) del type, val, tb context.registerBaseClass(ZEvent.OneTimeZEvent) ----- Original Message ----- From: "Bak @ kedai" <kedai@kedai.com.my> To: <zope@zope.org> Sent: June 20, 2000 07:06 PM Subject: [Zope] python product - newbie
hi all, <Newbie alert blaring>
i'm messing around with Boring product, and now wants to do more. i have problems when i got more than one class in a product. this is what i wanted to do.
create a guestbook (what else :)) product. GB.py with two classes - GB and GBitem. i can now load GB product, but can't add GBitem. what do i need to do to get the 'Add' selection box?
GB.py is available at http://203.106.2.206:8080/Tmp/GB
help, pointers, docs appreciated thabks
-- ------------------------------------------------------ http://www.kedai.com.my/kk Am I Evil?
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 How can I access the variables passed into a DTML called as a Form by another DTML? it has the usual ?x=1&y=2 ... stuff - I'd really like to loo through these. Also can I construct a string and then evaluate it? ie varname="therealvar" + "name" <some sort of eval> varname that would return the contents of the variable "therealvarname". John Holland -----BEGIN PGP SIGNATURE----- Version: PGP 6.5.2 iQA/AwUBOVDvihPWCCE2yAKHEQK0hgCgyaa+NJh7UTZrHwL8MnoMzVcNNo8AoL9b YfrnXWQpc70v5tVxYXwyJwsA =fZHi -----END PGP SIGNATURE-----
Not sure this is what you are looking for, but here it goes: On Wed, Jun 21, 2000 at 09:38:30AM -0700, jholland@gears.linuxave.net wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
How can I access the variables passed into a DTML called as a Form by another DTML? it has the usual ?x=1&y=2 ... stuff - I'd really like to loo through these.
I assume you have two fields in your form, like this: <form action="foo_dtml" method="POST"> <input type="text" name="x"> <input type="text" name="y"> ... </form> Then, in foo_dtml, you would display them as: <dtml-var x> <dtml-var y> Easy so far.
Also can I construct a string and then evaluate it? ie
varname="therealvar" + "name"
<some sort of eval> varname
that would return the contents of the variable "therealvarname".
I think this is what you are looking for: <dtml-let varname=" 'therealvar' + 'name' "> <!-- varname should now be equal to 'therealvarname' --> <dtml-var varname> </dtml-let> -- Patrick Lewis <pl@teleport.com>
On Thu, 22 Jun 2000, Loren Stafford wrote:
You don't show the __init__.py file so it's hard to be sure, but...
well, here's my __init__.py -- __doc__ = """Boring initialization module. My first product - Guest book See README.txt for more details.""" # Version string. Usually updated automatically by CVS. __version__ = '0.1' # Anything more and it'd be Interesting. # Step #1: import your Python class so we can refer to it later import GB def initialize(context): """Initialize the Boring product. registerClass() can accept a lot more arguments than we're providing here, but that wouldn't be Boring.""" try: """Try to register the product.""" context.registerClass( GB.GB, # Which is the addable bit? constructors = ( # The first of these is called GB.manage_addGBForm, # when someone adds the product; GB.manage_addGB), # the second is named here so we # can give people permission to # call it. icon = 'item.gif' # This icon was provided by the # Zope 1 product-in-Python demo. ) except: import sys, traceback, string type, val, tb = sys.exc_info() sys.stderr.write(string.join(traceback.format_exception(type, val, tb), '')) del type, val, tb --- i registered GB, with forms and it's equivalent manage action. that's ok. but to nest another class in GB, and to have the 'Add GBitem' show on the manage interface, that, i can't do. what should be added, and where? i looked at the old product API, but got more confused because i think Boring is based on another way of making product. is that so? thabks
I don't know about registering nested classes. I think Dieter Maurer answered that in his response to your original email. http://www.zope.org/Members/Zen/howto/ProductAPITutorial is the old way of doing it. http://www.zope.org/Members/gtk/Boring/HowTo-Boring documents the new way by example. http://www.zope.org/Members/michel/Projects/Interfaces/ProductRegistration is the new official documentation. There's an example of two classes there that might be relevant. -- Loren ----- Original Message ----- From: "Bak @ kedai" <kedai@kedai.com.my> To: "Loren Stafford" <lstaffor@dynalogic.com>; <zope@zope.org> Sent: June 21, 2000 08:51 PM Subject: Re: [Zope] python product - newbie [snip __init__.py]
i looked at the old product API, but got more confused because i think
Boring
is based on another way of making product. is that so?
thabks
participants (4)
-
Bak @ kedai -
jholland@gears.linuxave.net -
Loren Stafford -
Patrick Lewis