[Zope] Help needed for a s(i|a)mple site

flight@mathi.uni-heidelberg.de flight@mathi.uni-heidelberg.de
Fri, 12 Nov 1999 15:28:59 +0100


On Fri, Nov 12, 1999 at 08:47:57AM -0500, Mike Pelletier wrote:
>     What you're doing isn't normally done with ZClasses.  Chances are, you
> can do what you'd like much easier by using DTML Methods in the root and
> acquiring them in subfolders.  Since this isn't a production site, I'll
> assume you're using ZClasses just as an exercise.

I wanted to use ZClasses since they seemed to be a nice and easy way to
customize and limit the user interface (no dozens of products in a folder's
"Add" list) for content managers. I think this is how you did Zope.org,
not ?

In the meantime I managed to set up a product that somehow works like what
I described: I have a ZClass SRoot that's derived from a folderish ZClass
SFolder, and a ZClass SPage that actually contains the "render engine"
for pages (i.e. it contains the code for the navigations bars in 
customized standard_html_header and _footer methods, and an index_html that
currently only renders the property stext as structured text).


> <dtml-var standard_html_header>
> 
> <dtml-if "objectValues(['SFolder'])
>  <!-- display navigation links -->
> </dtml-if>
> 
> <dtml-if index_spage>
>  <dtml-var index_spage>
> <dtml-else>
>  <dtml-in "objectValues(['SPage'])">
>   <!-- display available pages -->
>  </dtml-in>
> </dtml-else>
> 
> <dtml-var standard_html_footer>

That's not exactly what I wanted to have: I need a SRoot (well, could
have used the site root, but this way it's more flexible), since my
SFolder navigation bar should alway display all folders from the site's
root on (just like the tree tag).

>     As you can see, nothing is happening here that couldn't be done by
> placing a similar index_html method in your root Zope folder and acquiring
> it in subfolders.

But without ZClasses, I wouldn't be able to customize the user experience 
for content editors the way you did in Zope.org, would I ?


I'm still struggling with one problem: Every SFolder should contain at
least one SPage (let's call it index_spage). How can I have that subobject
be added to any SFolder object ? If I try to add an SPage object to my
SFolderClass, I get an AttributeError from Zope (using 2.1.0beta1):

<!--
 Error type:  AttributeError
 Error value: spage_properties
-->

<!--
Traceback (innermost last):
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 252, in publish_module
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 207, in publish
  File /usr/lib/zope/lib/python/Zope/__init__.py, line 201, in zpublisher_exception_hook
      (Object: RoleManager)
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 193, in publish
  File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
      (Object: SPageClass_add)
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 102, in call_object
      (Object: SPageClass_add)
  File /usr/lib/zope/lib/python/OFS/DTMLMethod.py, line 145, in __call__
      (Object: SPageClass_add)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line 502, in __call__
    (Object: SPageClass_add)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_With.py, line 148, in render
      (Object: SPageClass.createInObjectManager(REQUEST['id'], REQUEST))
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_Util.py, line 335, in eval
      (Object: propertysheets.spage_properties.manage_editProperties(REQUEST))
    (Info: REQUEST)
  File <string>, line 0, in ?
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_Util.py, line 127, in careful_getattr
AttributeError: (see above)
>

    Gregor