[Zope] Now it's a "Folder" class question :-)

aaa@simplesky.com aaa@simplesky.com
Sun, 9 Sep 2001 01:01:42 +0200 (CEST)


Hi there, I'm stil trying to build my personal Folder product,
let's call it "minimal" (ok, ok, I'm working on tutorials :-)

I was trying to subclass ObjectManager, but then I've
been told to subclass Folder insted since it subclasses
ObjectManager itself (and it does, i checked).

I'm still trying to give my product a "Folder" feel,
that is, I want to be able to click on in and "enter"
it, and see what's inside it (that is the standard
Content view of a folder).

Now what happens is this: let my "minimal" object id be
"abc", and let it be contained by the "Test" folder.
when I click on it the url becomes http://.../Test/abc
so it looks like I'm inside it, but I still see
the "Test" folder content, that is I still see the "abc"
object. In other words it looks like if the "abc" object
contains itself.
If I click on it again the url becomes
http://.../Test/abc/abc and then abc/abc/abc and so on.
Why can't I "see" inside it and can't put other objects in
it?

Should I include something special? Should I put something
particular in the manage_options?

I'm sorry but I couldn't find anything in the docs :-(

and that's question one.
then, why (see code below) do I have to subclass the
Implicit class too?? if I don't do it I get:

 Exception type: TypeError
 Exception value: base is not a class object Traceback (innermost last):
  File /usr/local/Zope-2.4.1-linux2-x86/lib/python/App/RefreshFuncs.py,
line 255, in performSafeRefresh
  File /usr/local/Zope-2.4.1-linux2-x86/lib/python/App/RefreshFuncs.py,
line 242, in performRefresh
  File /usr/local/Zope-2.4.1-linux2-x86/lib/python/OFS/Application.py,
line 756, in reimport_product
  File /usr/local/Zope-2.4.1-linux2-x86/lib/python/OFS/Application.py,
line 558, in import_product
  File /usr/local/zope/lib/python/Products/minimal/__init__.py, line 1, in
?
  File /usr/local/zope/lib/python/Products/minimal/minimal.py, line 17, in
?
TypeError: base is not a class object



But if I subclass Folder that subclasses ObjectManager that subclasses
Aquisition.Implicit, why should I subclass Implicit again???



These Python-Zope products are pretty complicated, aren't they?

ok, this is my code:

# minimal.py

from OFS import Folder
from Acquisition import Implicit
from Globals import DTMLFile

class minimal(Implicit, Folder):

    "minimal object"

    meta_type='minimal'

    meta_types=()

    index_html=DTMLFile('www/index_html', globals())

    manage_options=(
        {'label': 'View', 'action': 'index_html'},
    )

    def __init__(self, id):
        "initialize a new instance of minimal"
        self.id=id

def manage_addMinimal(self, id, RESPONSE=None):
    "Add a minimal to a folder"
    self._setObject(id, minimal(id))
    RESPONSE.redirect('index_html')

manage_addMinimalForm=DTMLFile('www/manage_addMinimalForm', globals())




other file:
# __init__.py
import minimal

def initialize(context):
    """Initialize the minimal product
    this makes the object appear in the product list"""

    context.registerClass(
        minimal.minimal,
        constructors = ( minimal.manage_addMinimalForm ,
minimal.manage_addMinimal)
    )





I really thank you all for the help.
The zope community is just GREAT. I hope one day I'll be able
to give back to newbies what I'm learning now :-)


|G|