Commit 1f2d45db authored by Jim Fulton's avatar Jim Fulton

Added View class.

parent 014478d6
...@@ -84,17 +84,45 @@ ...@@ -84,17 +84,45 @@
############################################################################## ##############################################################################
"""Property sheets""" """Property sheets"""
__version__='$Revision: 1.2 $'[11:-2] __version__='$Revision: 1.3 $'[11:-2]
import time, string import time, string, App.Management
from ZPublisher.Converters import type_converters from ZPublisher.Converters import type_converters
from Globals import HTMLFile, MessageDialog from Globals import HTMLFile, MessageDialog
from string import find,join,lower,split from string import find,join,lower,split,rfind
from Acquisition import Implicit, Explicit from Acquisition import Implicit, Explicit
from ExtensionClass import Base from ExtensionClass import Base
from Globals import Persistent from Globals import Persistent
class View(App.Management.Tabs):
"""A view of an object, typically used for management purposes
"""
def manage_options(self):
"""Return a manage option data structure for me instance
"""
try: r=self.REQUEST
except: r=None
if r is None: pre='../../'
else:
pre=r['URL']
for i in (1,2,3):
l=rfind(pre,'/')
if l >= 0:
pre=pre[:l]
pre=pre+'/'
r=[]
for d in self.aq_parent.aq_parent.manage_options:
r.append({'label': d['label'],
'action': pre+d['action']+'/index_html'})
return r
def tabs_path_info(self, script, path):
l=rfind(path,'/')
if l >= 0: path=path[:l]
return PropertySheet.inheritedAttribute('tabs_path_info')(
self, script, path)
class PropertySheet(Persistent, Implicit): class PropertySheet(Persistent, Implicit):
"""A PropertySheet is a container for a set of related properties and """A PropertySheet is a container for a set of related properties and
...@@ -315,6 +343,7 @@ class PropertySheet(Persistent, Implicit): ...@@ -315,6 +343,7 @@ class PropertySheet(Persistent, Implicit):
class DefaultProperties(PropertySheet): class DefaultProperties(PropertySheet):
"""The default property set mimics the behavior of old-style Zope """The default property set mimics the behavior of old-style Zope
properties -- it stores its property values in the instance of properties -- it stores its property values in the instance of
...@@ -446,7 +475,7 @@ class PropertySheets(Implicit): ...@@ -446,7 +475,7 @@ class PropertySheets(Implicit):
default=DefaultProperties() default=DefaultProperties()
webdav =DAVProperties() webdav =DAVProperties()
def __init__(self, parent): def __init__(self, parent=None):
pass pass
def __propsets__(self): def __propsets__(self):
......
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