Commit d7cd936b authored by Jim Fulton's avatar Jim Fulton

Added methods to support tree browsing.

parent 3de30f23
"""Folder object
$Id: Folder.py,v 1.13 1997/09/26 20:20:20 brian Exp $"""
$Id: Folder.py,v 1.14 1997/10/30 19:50:49 jim Exp $"""
__version__='$Revision: 1.13 $'[11:-2]
__version__='$Revision: 1.14 $'[11:-2]
from Globals import HTMLFile
......@@ -92,11 +92,26 @@ class Folder(ObjectManager,RoleManager,DocumentHandler,
# 'action':'manage_help', 'target':'_new'},
)
def tpValues(self):
r=[]
if hasattr(self.aq_self,'tree_ids'):
for id in self.aq_self.tree_ids:
if hasattr(self, id): r.append(getattr(self, id))
else:
for id in self._objects:
o=getattr(self, id['id'])
try:
if subclass(o.__class__, Folder): r.append(o)
except: pass
return r
def subclass(c,super):
if c is super: return 1
try:
for base in c.__bases__:
if subclass(base,super): return 1
except: pass
return 0
......@@ -16,8 +16,8 @@ Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new
item types.
$Id: SimpleItem.py,v 1.1 1997/09/10 18:42:36 jim Exp $'''
__version__='$Revision: 1.1 $'[11:-2]
$Id: SimpleItem.py,v 1.2 1997/10/30 19:51:09 jim Exp $'''
__version__='$Revision: 1.2 $'[11:-2]
class Item:
......@@ -53,6 +53,14 @@ class Item:
def this(self):
return self
# Interact with tree tag
def tpURL(self):
url=self.id
if hasattr(url,'im_func'): url=url()
return url
def tpValues(self): return ()
class Item_w__name__(Item):
# Utility that returns the title if it is not blank and the id
......@@ -70,6 +78,9 @@ class Item_w__name__(Item):
##############################################################################
#
# $Log: SimpleItem.py,v $
# Revision 1.2 1997/10/30 19:51:09 jim
# Added methods to support tree browsing.
#
# Revision 1.1 1997/09/10 18:42:36 jim
# Added SimpleItem mix-in and new title/id methods.
#
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment