Author: jvloothuis
Date: Sun Dec 9 14:49:55 2007
New Revision: 49570
Removed:
kukit/kss.zope/trunk/kss/core/kssview.txt
kukit/kss.zope/trunk/kss/core/tests/test_kssview.py
Log:
Removed the KSS view from kss.core since they have been ported to kss.zope
Deleted: /kukit/kss.zope/trunk/kss/core/kssview.txt
==============================================================================
--- /kukit/kss.zope/trunk/kss/core/kssview.txt Sun Dec 9 14:49:55 2007
+++ (empty file)
@@ -1,67 +0,0 @@
-====================
-KSS views and events
-====================
-
-When we make a change using Ajax calls we would like to update the
-browser page. This can be done by sending browser commands. Some part
-of the page may need to be update based on modifications.
-
-We don't want to handle all these modifications in our own code. An
-example of such a modification change would be changing the
-title. This should also update the navigation portlet.
-
-To make this work KSS views do something special. We will explain
-this by creating an example. The following will setup our enviroment
-and show that normal operation works.
-
- >>> from kss.core import KSSView
- >>> from zope import component
- >>> from zope.lifecycleevent import ObjectModifiedEvent
- >>> from zope.lifecycleevent.interfaces import IObjectModifiedEvent
- >>> from zope.publisher.browser import TestRequest
- >>> from zope.publisher.http import HTTPResponse
- >>> from zope import event
-
- >>> from zope.app.folder import folder
- >>> myfolder = folder.rootFolder()
- >>> request = TestRequest()
- >>> request.RESPONSE = HTTPResponse()
-
-Now we will write our custom.
-
- >>> class SampleView(KSSView):
- ... def setTitle(self, title):
- ... self.context.title = title
- ... event.notify(ObjectModifiedEvent(self.context))
- ... return self.render()
-
- >>> view = SampleView(myfolder, request)
-
-Simulate traversal by making the view the current site:
-
- >>> from zope.app.component.hooks import setSite
- >>> setSite(view)
-
-Let's set a title:
-
- >>> view.setTitle("some title")
- []
-
-Now that we have shown that this will not generate any KSS commands
-we will register a handler. This handler will catch the object event
-and add some KSS commands.
-
- >>> @component.adapter(None, SampleView, IObjectModifiedEvent)
- ... def stuff_happend(object, view, event):
- ... view.getCommandSet('core').replaceInnerHTML(
- ... 'div.class', object.title)
- >>> component.provideHandler(stuff_happend)
-
-When we call the renderer now it should have some more data in it.
-(html parameters are marshalled as CDATA, so we check for that too)
-
- >>> view = SampleView(myfolder, request)
- >>> setSite(view)
-
- >>> view.setTitle(u"some title")[0]['params']['html']
- u'<![CDATA[some title]]>'
Deleted: /kukit/kss.zope/trunk/kss/core/tests/test_kssview.py
==============================================================================
--- /kukit/kss.zope/trunk/kss/core/tests/test_kssview.py Sun Dec 9
14:49:55 2007
+++ (empty file)
@@ -1,56 +0,0 @@
-# -*- coding: latin-1 -*-
-# Copyright (c) 2005-2007
-# Authors: KSS Project Contributors (see docs/CREDITS.txt)
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as published
-# by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-import unittest
-
-from kss.core.interfaces import IKSSView, IKSSCommands
-from kss.core.plugins.core.interfaces import IKSSCoreCommands
-from kss.core.plugins.core.commands import KSSCoreCommands
-from kss.core.pluginregistry.interfaces import IAction, ICommandSet
-from kss.core.pluginregistry.action import Action
-from kss.core.pluginregistry.plugin import registerPlugin
-from kss.core.pluginregistry.commandset import CommandSet
-from kss.core.tests.commandinspector import CommandInspectorView
-
-import zope.component.event
-from zope.testing import doctest, cleanup
-from zope.publisher.interfaces.browser import IBrowserRequest
-from zope.app.component.hooks import setHooks
-
-def setUpAjaxView(test=None):
- setHooks()
- zope.component.provideAdapter(CommandInspectorView,
- adapts=(IKSSCommands, IBrowserRequest))
- registerPlugin(Action, IAction, 'replaceInnerHTML', None,
- 'selector', 'html', [], None)
- zope.component.provideAdapter(KSSCoreCommands,
- adapts=(IKSSView,),
- provides=IKSSCoreCommands)
- registerPlugin(CommandSet, ICommandSet, 'core', IKSSCoreCommands)
-
-def tearDownAjaxView(test=None):
- cleanup.cleanUp()
-
-def test_suite():
- return unittest.TestSuite([
- doctest.DocTestSuite('kss.core.kssview'),
- doctest.DocFileSuite('kssview.txt',
- package='kss.core',
- setUp=setUpAjaxView,
- tearDown=tearDownAjaxView),
- ])
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins