Hi all, i've just started with zope, and i'm trying to write a filesystem product, so i can have a project in svn and work on it in the filesystem. I've followed the guide at zope.org for creating a minimal product, but can't get this to show up in the list of products. Can anyone see whats wrong? Thanks for reading, Paul __init.py__ ----------- import minimal def initialize(context): """init the product""" contect.registerClass(minimal.minimal,constructor=(minimal.manage_addMinimal,)) minimal.py ---------- from OFS import SimpleItem class minimal(SimpleItem.SimpleItem): """minimal object""" meta_type = 'minimal' def __init__(self,id): """initialise new instance""" self.id = id def index_html(self): """used to view content of the object""" return '<html><body> Hello </body></html>' def manage_addMinimal(self, RESPONSE): """add minimal obj to folder""" self._setObject('minimal_id', minimal('minimal_id')) RESPONSE.redirect('index_html')
Paul Hendrick wrote:
Hi all, i've just started with zope, and i'm trying to write a filesystem product, so i can have a project in svn and work on it in the filesystem. I've followed the guide at zope.org for creating a minimal product, but can't get this to show up in the list of products.
If you are starting from scratch learning Zope, and you don't want to use one of the frameworks, it would be far better to start on Zope 3 It's better coded, easier to understand, more futureproof and probably better documented. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science
Paul Hendrick wrote:
Hi all, i've just started with zope, and i'm trying to write a filesystem product, so i can have a project in svn and work on it in the filesystem. I've followed the guide at zope.org for creating a minimal product, but can't get this to show up in the list of products.
You have of course restarted your zope instance ?
Can anyone see whats wrong?
__init.py__
should be __init__.py
----------- import minimal def initialize(context): """init the product"""
contect.registerClass(minimal.minimal,constructor=(minimal.manage_addMinimal,))
This line should be indented. There's a typo also : s/contect/context/ Anyway, unless you have a compelling reason to stick with Zope 2.x, you should consider starting with Zope 3. -- Bruno Desthuilliers Développeur bruno@modulix.org
you registered the manage_addminimal function for creating the actual object, but what about the ZMI form that lets call manage_addminimal? On 9/2/05, Paul Hendrick <paul.hendrick@gmail.com> wrote:
Hi all, i've just started with zope, and i'm trying to write a filesystem product, so i can have a project in svn and work on it in the filesystem. I've followed the guide at zope.org for creating a minimal product, but can't get this to show up in the list of products.
Can anyone see whats wrong? Thanks for reading, Paul
__init.py__ ----------- import minimal def initialize(context): """init the product"""
contect.registerClass(minimal.minimal,constructor=(minimal.manage_addMinimal,))
minimal.py ---------- from OFS import SimpleItem class minimal(SimpleItem.SimpleItem): """minimal object""" meta_type = 'minimal' def __init__(self,id): """initialise new instance""" self.id = id def index_html(self): """used to view content of the object""" return '<html><body> Hello </body></html>' def manage_addMinimal(self, RESPONSE): """add minimal obj to folder""" self._setObject('minimal_id', minimal('minimal_id')) RESPONSE.redirect('index_html')
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
Peter Bengtsson wrote:
you registered the manage_addminimal function for creating the actual object, but what about the ZMI form that lets call manage_addminimal?
It is not necessary in this case, as the function sets the id and adds the instance. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science
participants (4)
-
bruno modulix -
Max M -
Paul Hendrick -
Peter Bengtsson