Commit 311847e9 authored by Michel Pelletier's avatar Michel Pelletier

First cut at interface definitions

parent c83a9e5d
from Zope.Interfaces.Interface import Interface
from ItemInterface import ItemInterface
from PropertyManagerInterface import PropertyManagerInterface
class File:
"""
Description of the Image interface
"""
__extends__ = (ItemInterface,
PropertyManagerInterface,
)
def id(self):
"""
Returns the id of the file.
"""
def update_data(self, data, content_type=None, size=None):
"""
Updates the File with 'data'.
"""
def getSize(self):
"""
Returns the size of the file.
"""
get_size = getSize
def getContentType(self):
"""
Returns the content type of the file.
"""
FileInterface=Interface(File) # create the interface object
from Zope.Interfaces.Interface import Interface
class FindSupport:
"""
Description of the FindSupport interface
"""
def ZopeFind(self, obj, obj_ids=None, obj_metatypes=None,
obj_searchterm=None, obj_expr=None,
obj_mtime=None, obj_mspec=None,
obj_permission=None, obj_roles=None,
search_sub=0,
REQUEST=None, result=None, pre=''):
"""
Finds stuff.
"""
def ZopeFindAndApply(self, obj, obj_ids=None, obj_metatypes=None,
obj_searchterm=None, obj_expr=None,
obj_mtime=None, obj_mspec=None,
obj_permission=None, obj_roles=None,
search_sub=0,
REQUEST=None, result=None, pre='',
apply_func=None, apply_path=''):
"""
Finds stuff and applies each found object to 'apply_func'.
"""
FindSupportInterface=Interface(FindSupport) # create the interface object
...@@ -87,9 +87,9 @@ ...@@ -87,9 +87,9 @@
Folders are the basic container objects and are analogous to directories. Folders are the basic container objects and are analogous to directories.
$Id: Folder.py,v 1.84 1999/12/09 23:38:30 amos Exp $""" $Id: Folder.py,v 1.85 2000/03/13 21:36:02 michel Exp $"""
__version__='$Revision: 1.84 $'[11:-2] __version__='$Revision: 1.85 $'[11:-2]
import Globals, SimpleItem import Globals, SimpleItem
from ObjectManager import ObjectManager from ObjectManager import ObjectManager
...@@ -99,6 +99,7 @@ from webdav.Collection import Collection ...@@ -99,6 +99,7 @@ from webdav.Collection import Collection
from FindSupport import FindSupport from FindSupport import FindSupport
from Globals import HTMLFile from Globals import HTMLFile
from FolderInterface import FolderInterface
manage_addFolderForm=HTMLFile('folderAdd', globals()) manage_addFolderForm=HTMLFile('folderAdd', globals())
...@@ -147,6 +148,8 @@ class Folder(ObjectManager, PropertyManager, RoleManager, Collection, ...@@ -147,6 +148,8 @@ class Folder(ObjectManager, PropertyManager, RoleManager, Collection,
""" """
meta_type='Folder' meta_type='Folder'
__implements__=(FolderInterface,)
_properties=({'id':'title', 'type': 'string'},) _properties=({'id':'title', 'type': 'string'},)
manage_options=( manage_options=(
......
from Zope.Interfaces.Interface import Interface
from ObjectManagerInterface import ObjectManagerInterface
from PropertyManagerInterface import PropertyManagerInterface
from AccessControl.RoleManagerInterface import RoleManagerInterface
from ItemInterface import ItemInterface
from FindSupportInterface import FindSupportInterface
class Folder:
"""
A Folder object can contain other Zope objects, including other
Folders. It is the generic 'container' object for Zope managment.
It is analogous to a UNIX 'directory' or a Windows 'Folder'.
"""
__extends__ = (ObjectManagerInterface,
PropertyManagerInterface,
RoleManagerInterface,
ItemInterface,
FindSupportInterface,
)
FolderInterface=Interface(Folder) # create the interface object
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Image object""" """Image object"""
__version__='$Revision: 1.94 $'[11:-2] __version__='$Revision: 1.95 $'[11:-2]
import Globals, string, struct, content_types import Globals, string, struct, content_types
from OFS.content_types import guess_content_type from OFS.content_types import guess_content_type
...@@ -98,6 +98,9 @@ from Globals import Persistent ...@@ -98,6 +98,9 @@ from Globals import Persistent
from Acquisition import Implicit from Acquisition import Implicit
from DateTime import DateTime from DateTime import DateTime
from FileInterface import FileInterface
from ImageInterface import ImageInterface
StringType=type('') StringType=type('')
manage_addFileForm=HTMLFile('imageAdd', globals(),Kind='File',kind='file') manage_addFileForm=HTMLFile('imageAdd', globals(),Kind='File',kind='file')
...@@ -127,6 +130,9 @@ class File(Persistent,Implicit,PropertyManager, ...@@ -127,6 +130,9 @@ class File(Persistent,Implicit,PropertyManager,
"""A File object is a content object for arbitrary files.""" """A File object is a content object for arbitrary files."""
meta_type='File' meta_type='File'
__implements__=(FileInterface,)
precondition='' precondition=''
size=None size=None
...@@ -402,6 +408,9 @@ class Image(File): ...@@ -402,6 +408,9 @@ class Image(File):
renders an HTML 'IMG' tag. renders an HTML 'IMG' tag.
""" """
meta_type='Image' meta_type='Image'
__implements__=(ImageInterface,)
height='' height=''
width='' width=''
......
from Zope.Interfaces.Interface import Interface
from FileInterface import FileInterface
class Image:
"""
Description of the Image interface
"""
__extends__ = (FileInterface,)
def update_data(self, data, content_type=None, size=None):
"""
Replaces the Image with 'data'.
"""
def tag(self, height=None, width=None, alt=None,
scale=0, xscale=0, yscale=0, **args):
"""
Generate an HTML IMG tag for this image, with customization.
Arguments to self.tag() can be any valid attributes of an IMG
tag. 'src' will always be an absolute pathname, to prevent
redundant downloading of images. Defaults are applied
intelligently for 'height', 'width', and 'alt'. If specified,
the 'scale', 'xscale', and 'yscale' keyword arguments will be
used to automatically adjust the output height and width
values of the image tag.
"""
ImageInterface=Interface(Image) # create the interface object
from Zope.Interfaces.Interface import Interface
from ZDOMInterface import ElementInterface
class Item:
"""
Description of the Item interface
"""
__extends__ = (ElementInterface,)
def title_or_id(self):
"""
Descripotion
"""
def title_and_id(self):
"""
Description
"""
def this(self):
"""
description
"""
def absolute_url(self, relative=1):
"""
description
"""
ItemInterface=Interface(Item) # create the interface object
from Zope.Interfaces.Interface import Interface
class ObjectManager:
"""
Description of the ObjectManager interface
"""
def objectIds(self, spec=None):
"""
'objectIds' returns the ids of objects in this ObjectManager.
If the optional argument 'spec' is provided, then only ids of
objects of meta_type 'spec' will be returned. 'spec' can be
either a string or a list of strings.
"""
def objectValues(self, spec=None):
"""
'objectValues' returns the actuall subobjects in this
ObjectManager. If the optional argument 'spec' is provided,
then only objects of meta_type 'spec' will be returned.
'spec' can be either a string or a list of strings.
"""
def objectItems(self, spec=None):
"""
'objectItems' returns a list of (id, subobject) tuples in this
ObjectManager. if the optional argument 'spec' is provided,
then only objects of meta_type 'spec' will be returned.
'spec' can be either a string or a list of strings.
"""
def objectMap(self):
"""
Returns a tuple of mappings containing subobject meta-data.
"""
def superValues(self, t):
"""
'superValues' returns a list of objects of the given meta_type
't'. This search is performed in the current ObjectManager
and all ObjectManagers above it.
"""
ObjectManagerInterface=Interface(ObjectManager) # create the interface object
from Zope.Interfaces.Interface import Interface
class PropertyManager:
"""
Description of the PropertyManager interface
"""
def valid_property_id(self, id):
"""
Returns a true result if 'id' is a valid property name and is
not allready an attribute of 'self'.
"""
def getProperty(self, id, d=None):
"""
Get the property 'id', returning the optional second
argument or None if no such property is found.
"""
def getPropertyType(self, id):
"""
Get the type of property 'id'. returns None if no such
property exists.
"""
def hasProperty(self, id):
"""
Returns a true value if 'self' has the property 'id'.
Otherwise returns a false value.
"""
def propertyIds(self):
"""
Returns a list of property ids.
"""
def propertyValues(self):
"""
Returns a list of actual property objects.
"""
def propertyIds(self):
"""
Return a list of (id, property) tuples.
"""
def propertyMap(self):
"""
Returns a tuple of mappings, giving meta-data for properties.
"""
def propertyLable(self, id):
"""
Returns a label for the given property 'id'. This just
returns 'id'.
"""
def propdict(self):
"""
Returns a mapping from property id to property object.
"""
PropertyManagerInterface=Interface(PropertyManager) # create the interface object
from Zope.Interfaces.Interface import Interface
class Node:
"""
A node.
"""
NodeInterface=Interface(Node) # create the interface object
class Document:
"""A document.
"""
__extends__ = (NodeInterface,)
DocumentInterface=Interface(Document) # create the interface object
class Element:
"""An element.
"""
__extends__ = (NodeInterface,)
ElementInterface=Interface(Element) # create the interface object
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