Back to index

plone3  3.1.7
interfaces.py
Go to the documentation of this file.
00001 from zope.interface import Interface
00002 from zope.schema import (
00003     TextLine,
00004     List,
00005     )
00006 
00007 class ISimpleContent(Interface):
00008     pass
00009 
00010 # --
00011 # Resources
00012 # --
00013 
00014 class IKSSDemo(Interface):
00015     """Represents an actual demo page"""
00016 
00017     plugin_namespace = TextLine(
00018         title=u"plugin_namespace",
00019         description=u'string with the name of the plugin.'
00020                     u'Or: "" when it is the core part.',
00021         required=False,
00022         )
00023 
00024     category = TextLine(
00025         title=u"component",
00026         description=u'text that will appear as the title of the'
00027                     u'category. "" if out of category.',
00028         required=False,
00029         )
00030 
00031     page_url = TextLine(
00032         title=u"page_url",
00033         description=u'(relative) url of the demo page. This should'
00034                     u'traverse on ISimpleContent.',
00035         required=True,
00036         )
00037 
00038     title = TextLine(
00039         title=u"title",
00040         description=u'Title of the demo. This also identifies it'
00041                     u'for removal.',
00042         required=True,
00043         )
00044 
00045 class IKSSSeleniumTestDirectory(Interface):
00046     """Represents an actual selenium test directory"""
00047 
00048     test_directory = TextLine(
00049         title=u"test directory",
00050         description=u'Relative directory path, contains *.html selenium tests',
00051         required=False,
00052         )
00053 
00054 # --
00055 # Resource definition interfaces
00056 # --
00057 
00058 class IKSSDemoResource(Interface):
00059     """An utility that a demo needs to register"""
00060 
00061     # list of IKSSDemo
00062     demos = List(
00063         title=u"demos",
00064         description=u'The ordered list of demos contained in this plugin',
00065         required=True,
00066         )
00067 
00068 class IKSSSeleniumTestResource(Interface):
00069     """An utility that a demo needs to register"""
00070 
00071     # list of IKSSSeleniumTestDir
00072     selenium_tests = List(
00073         title=u"selenium tests",
00074         description=u'The list of selenium test directories contained in this plugin',
00075         required=True,
00076         )
00077 
00078 # --
00079 # The registry itself
00080 # --
00081 
00082 class IKSSDemoRegistry(Interface):
00083     """Faciliates registration of demos.
00084 
00085     Implementations must look after the IKSSDemoResource
00086     adapters, and use their content to set up themselves.
00087     """
00088 
00089     def registerDemo(demo):
00090         """Register a demo
00091 
00092         It has the attributes specified in IKSSDemo:
00093 
00094         plugin_namespace - string with the name of the plugin.
00095                            Or: "" when it is the core part.
00096 
00097         category         - text that will appear as the title of the
00098                            category. "" if out of category.
00099 
00100         demo_page        - (relative) url of the demo page. This should
00101                            traverse on ISimpleContent.
00102 
00103         title            - Title of the demo. This also identifies it
00104                            for removal.
00105         """
00106  
00107     def unregisterDemo(demo):
00108         """Unregister the given demo."""
00109 
00110     def getSortedDemos():
00111         """Get the (sorted) list of demos"""
00112 
00113 class IKSSSeleniumTestRegistry(Interface):
00114     """Faciliates registration of demos.
00115 
00116     Implementations must look after the IKSSSeleniumTestResource
00117     adapters, and use their content to set up themselves.
00118     """
00119 
00120     def registerSeleniumTestFile(test_filename):
00121         """Register a selenium test directory
00122 
00123         It test_dir has the "filename" attributes specified in IKSSSeleniumTest.
00124         """
00125     
00126     def unregisterSeleniumTestFile(test_filename):
00127         """Unregister the given test directory."""
00128 
00129 
00130 # --
00131 # Event that gets redispatched, for allowing
00132 # the listeners to filter on component
00133 # --
00134 
00135 class IKSSDemoRegistrationEvent(Interface):
00136     """Redispatched event for registration of
00137     IKSSDemoRegistration utilities (resources).
00138     """
00139 
00140 class IKSSDemoRegistryEvent(Interface):
00141     """Redispatched event for registration of
00142     IKSSDemoRegistry utilities.
00143     """