Back to index

plone3  3.1.7
_content.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
00004 #
00005 # This software is subject to the provisions of the Zope Public License,
00006 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
00007 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00008 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00009 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00010 # FOR A PARTICULAR PURPOSE.
00011 #
00012 ##############################################################################
00013 """ CMFDefault content interfaces.
00014 
00015 $Id: _content.py 77345 2007-07-03 13:46:57Z yuppie $
00016 """
00017 
00018 from zope.interface import Interface
00019 
00020 class IHTMLScrubber(Interface):
00021     """ Utility inteface for scrubbing user-supplied HTML.
00022     """
00023     def scrub(html):
00024         """ Return 'scrubbed' HTML.
00025         """
00026 
00027 class IDocument(Interface):
00028 
00029     """ Textual content, in one of several formats.
00030 
00031     o Allowed formats include: structured text, HTML, plain text.
00032     """
00033 
00034     def CookedBody():
00035         """ Get the "cooked" (ready for presentation) form of the text.
00036         """
00037 
00038     def EditableBody():
00039         """ Get the "raw" (as edited) form of the text.
00040         """
00041 
00042 
00043 class IMutableDocument(IDocument):
00044 
00045     """ Updatable form of IDocument.
00046     """
00047 
00048     def edit(text_format, text, file='', safety_belt=''):
00049         """ Update the document.
00050 
00051         o 'safety_belt', if passed, must match the value issued when the edit
00052         began.
00053         """
00054 
00055 
00056 class INewsItem(IDocument):
00057 
00058     """A special document for news.
00059     """
00060 
00061     def edit(text, description=None, text_format=None):
00062         """Edit the News Item.
00063         """
00064 
00065 
00066 class IMutableNewsItem(INewsItem):
00067 
00068     """Updatable form of INewsItem.
00069     """
00070 
00071 
00072 class ILink(Interface):
00073 
00074     """ URL as content.
00075     """
00076 
00077     def getRemoteUrl():
00078         """ Return the URL to which the link points, as a string.
00079         """
00080 
00081 
00082 class IMutableLink(ILink):
00083 
00084     """ Updatable form of ILink.
00085     """
00086 
00087     def edit(remote_url):
00088         """ Update the link.
00089 
00090         o 'remote_url' should be a URL in an RFC-compatible form.
00091 
00092         o If 'remote_url' is unparseable by urllib, raise ValueError.
00093         """
00094 
00095 
00096 class IFavorite(ILink):
00097 
00098     """ Link to an internal object.
00099     """
00100 
00101     def getObject():
00102         """ Get the actual object that the Favorite is linking to.
00103         """
00104 
00105 
00106 class IMutableFavorite(IFavorite, IMutableLink):
00107 
00108     """ Updatable form of IFavorite.
00109     """
00110 
00111 
00112 class IFile(Interface):
00113 
00114     """ Binary content.
00115     """
00116 
00117     def get_size():
00118         """ Get the byte size of the file data.
00119         """
00120 
00121     def getContentType():
00122         """ Get the MIME type of the file data.
00123         """
00124 
00125     def __str__():
00126         """ Get the file data.
00127         """
00128 
00129 
00130 class IMutableFile(IFile):
00131 
00132     """ Updatable form of IFile.
00133     """
00134 
00135     def manage_upload(file='', REQUEST=None):
00136         """ Replaces the current data of the object with file.
00137         """
00138 
00139 
00140 class IImage(IFile):
00141 
00142     """ Image content.
00143     """
00144 
00145     def __str__():
00146         """ Get the default HTML 'img' tag for this image.
00147         """
00148 
00149 
00150 class IMutableImage(IImage, IMutableFile):
00151 
00152     """ Updatable form of IImage.
00153     """