Re: [Zope] python product - newbie
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" <[EMAIL PROTECTED]> To: "Loren Stafford" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> 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 > ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] python product - newbie
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 ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] python product - newbie
Bak @ kedai writes: > 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? You probably have only registered one of the classes as meta types. Have a look at "Products/ZSQLMethods/__init__.py". It registers two classes "Z SQL Methods" and "Z Search Interface". There should be a Product API Guide somewhere on zope.org. That's the documentation, that may help you. Dieter ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] python product - newbie
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" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: June 20, 2000 07:06 PM Subject: [Zope] python product - newbie > hi all, > > > 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 - [EMAIL PROTECTED] > 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 ) > ___ Zope maillist - [EMAIL PROTECTED] 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 )