[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kupu-checkins
Subject:    [kupu-checkins] r14851 - in kupu/branch/plone-2.1: common plone
From:       duncan () codespeak ! net
Date:       2005-07-21 11:39:20
Message-ID: 20050721113920.E090027B6C () code1 ! codespeak ! net
[Download RAW message or body]

Author: duncan
Date: Thu Jul 21 13:39:15 2005
New Revision: 14851

Modified:
   kupu/branch/plone-2.1/common/kupueditor.js
   kupu/branch/plone-2.1/common/kupuspellchecker.js
   kupu/branch/plone-2.1/common/kupustart.js
   kupu/branch/plone-2.1/common/kupustart_form.js
   kupu/branch/plone-2.1/common/kupustart_multi.js
   kupu/branch/plone-2.1/plone/html2captioned.py
   kupu/branch/plone-2.1/plone/librarytool.py
   kupu/branch/plone-2.1/plone/plonelibrarytool.py
   kupu/branch/plone-2.1/plone/tests/output/linked.out
   kupu/branch/plone-2.1/plone/tests/output/notcaptioned.out
   kupu/branch/plone-2.1/plone/tests/output/notquoted.out
   kupu/branch/plone-2.1/plone/tests/output/simple.out
   kupu/branch/plone-2.1/plone/tests/runalltests.py
   kupu/branch/plone-2.1/plone/tests/runme.cmd
   kupu/branch/plone-2.1/plone/tests/test_browserSupportsKupu.py
   kupu/branch/plone-2.1/plone/tests/test_html2captioned.py
   kupu/branch/plone-2.1/plone/tests/test_resourcetypemapper.py
   kupu/branch/plone-2.1/silva/kupusilvatools.js
Log:
Merged changes from trunk 14575 to HEAD (14850)

Modified: kupu/branch/plone-2.1/common/kupueditor.js
==============================================================================
--- kupu/branch/plone-2.1/common/kupueditor.js	(original)
+++ kupu/branch/plone-2.1/common/kupueditor.js	Thu Jul 21 13:39:15 2005
@@ -234,7 +234,7 @@
         var contents = this._serializeOutputToString(transform);
         
         this.logMessage(_("Cleanup done, sending document to server"));
-        var request = Sarissa.getXmlHttpRequest();
+        var request = new XMLHttpRequest();
     
         if (!synchronous) {
             request.onreadystatechange = (new ContextFixer(this._saveCallback, 
@@ -593,7 +593,7 @@
         this._previous_range = null;
     };
 
-    this._filterContent = function(documentElement) {
+    this._filterContent = function(documentElement) {            
         /* pass the content through all the filters */
         // first copy all nodes to a Sarissa document so it's usable
         var xhtmldoc = Sarissa.getDomDocument();

Modified: kupu/branch/plone-2.1/common/kupuspellchecker.js
==============================================================================
--- kupu/branch/plone-2.1/common/kupuspellchecker.js	(original)
+++ kupu/branch/plone-2.1/common/kupuspellchecker.js	Thu Jul 21 13:39:15 2005
@@ -17,7 +17,7 @@
 };
 
 KupuSpellChecker.prototype.check = function() {
-    var request = Sarissa.getXmlHttpRequest();
+    var request = new XMLHttpRequest();
     request.open('POST', this.scripturl, true);
     request.setRequestHeader('Content-Type', 
                                 'application/x-www-form-urlencoded');

Modified: kupu/branch/plone-2.1/common/kupustart.js
==============================================================================
--- kupu/branch/plone-2.1/common/kupustart.js	(original)
+++ kupu/branch/plone-2.1/common/kupustart.js	Thu Jul 21 13:39:15 2005
@@ -15,7 +15,7 @@
     // if there's no global 'i18n_message_catalog' variable available, don't
     // try to load any translations
     if (window.i18n_message_catalog) {
-        var request = Sarissa.getXmlHttpRequest();
+        var request = new XMLHttpRequest();
         // sync request, scary...
         request.open('GET', 'kupu-pox.cgi', false);
         request.send('');

Modified: kupu/branch/plone-2.1/common/kupustart_form.js
==============================================================================
--- kupu/branch/plone-2.1/common/kupustart_form.js	(original)
+++ kupu/branch/plone-2.1/common/kupustart_form.js	Thu Jul 21 13:39:15 2005
@@ -38,7 +38,7 @@
             continueStartKupu(kupu);
         };
     };
-    var request = Sarissa.getXmlHttpRequest();
+    var request = new XMLHttpRequest();
     request.onreadystatechange = (new ContextFixer(handler, request)).execute;
     request.open('GET', 'kupu.pox', true);
     request.send('');

Modified: kupu/branch/plone-2.1/common/kupustart_multi.js
==============================================================================
--- kupu/branch/plone-2.1/common/kupustart_multi.js	(original)
+++ kupu/branch/plone-2.1/common/kupustart_multi.js	Thu Jul 21 13:39:15 2005
@@ -37,7 +37,7 @@
             continueStartKupu(kupu);
         };
     };
-    var request = Sarissa.getXmlHttpRequest();
+    var request = new XMLHttpRequest();
     request.onreadystatechange = (new ContextFixer(handler, request)).execute;
     request.open('GET', 'kupu.pox', true);
     request.send('');

Modified: kupu/branch/plone-2.1/plone/html2captioned.py
==============================================================================
--- kupu/branch/plone-2.1/plone/html2captioned.py	(original)
+++ kupu/branch/plone-2.1/plone/html2captioned.py	Thu Jul 21 13:39:15 2005
@@ -43,7 +43,7 @@
 CLASS_PATTERN = re.compile('\s*class=("[^"]*captioned[^"]*"|[^" \/>]+)')
 IMAGE_TEMPLATE = '''\
 <div class="%(class)s" style="width:%(width)spx;">
- <div style="width:%(width)s">
+ <div style="width:%(width)spx;">
   %(tag)s
  </div>
  <div class="image-caption">

Modified: kupu/branch/plone-2.1/plone/librarytool.py
==============================================================================
--- kupu/branch/plone-2.1/plone/librarytool.py	(original)
+++ kupu/branch/plone-2.1/plone/librarytool.py	Thu Jul 21 13:39:15 2005
@@ -13,6 +13,7 @@
 
 $Id$
 """
+import Acquisition
 from Acquisition import aq_parent, aq_inner, aq_base
 from Products.CMFCore.Expression import Expression
 from Products.CMFCore.Expression import createExprContext
@@ -21,7 +22,7 @@
 
 class KupuError(Exception): pass
 
-class KupuLibraryTool:
+class KupuLibraryTool(Acquisition.Implicit):
     """A tool to aid Kupu libraries"""
 
     __implements__ = IKupuLibraryTool

Modified: kupu/branch/plone-2.1/plone/plonelibrarytool.py
==============================================================================
--- kupu/branch/plone-2.1/plone/plonelibrarytool.py	(original)
+++ kupu/branch/plone-2.1/plone/plonelibrarytool.py	Thu Jul 21 13:39:15 2005
@@ -148,7 +148,7 @@
         return getattr(self, 'install_beforeunload', True)
 
     security.declareProtected('View', 'isKupuEnabled')
-    def isKupuEnabled(self, useragent='', REQUEST=None):
+    def isKupuEnabled(self, useragent='', allowAnonymous=False, REQUEST=None):
         def numerics(s):
             '''Convert a string into a tuple of all digit sequences
             '''
@@ -162,6 +162,9 @@
 
         # First check whether the user actually wants kupu
         pm = getToolByName(self, 'portal_membership')
+        if pm.isAnonymousUser() and not allowAnonymous:
+            return False
+
         user = pm.getAuthenticatedMember()
         if user.getProperty('wysiwyg_editor').lower() != 'kupu':
             return False
@@ -218,7 +221,7 @@
 
     security.declarePublic('docs')
     def docs(self):
-        """Returns FormController docs formatted as HTML"""
+        """Returns Kupu docs formatted as HTML"""
         docpath = os.path.join(Globals.package_home(kupu_globals), 'doc')
         f = open(os.path.join(docpath, 'PLONE2.txt'), 'r')
         _docs = f.read()
@@ -226,7 +229,7 @@
 
     security.declareProtected(permissions.ManageLibraries, "zmi_docs")
     zmi_docs = PageTemplateFile("zmi_docs.pt", globals())
-    zmi_docs.title = 'kupu configuration'
+    zmi_docs.title = 'kupu configuration documentation'
 
     security.declareProtected(permissions.ManageLibraries, "sanity_check")
     sanity_check = PageTemplateFile("sanity_check.pt", globals())

Modified: kupu/branch/plone-2.1/plone/tests/output/linked.out
==============================================================================
--- kupu/branch/plone-2.1/plone/tests/output/linked.out	(original)
+++ kupu/branch/plone-2.1/plone/tests/output/linked.out	Thu Jul 21 13:39:15 2005
@@ -1,9 +1,9 @@
 <div>Simple text containing an embedded image</div>
-<div class="image-left captioned">
- <div style="width:120">
-  <a href="xyzzy" class="link"><img height="144" alt="picture alt text" \
src="resolveuid/104ede98d4c7c8eaeaa3b984f7395979" width="120"/></a> +<div \
class="image-left captioned" style="width:120px;"> + <div style="width:120px;">
+  <a href="xyzzy" class="link"><img height="144" alt="picture alt text" src="[url \
for 104ede98d4c7c8eaeaa3b984f7395979]" width="120"/></a>  </div>
- <div class="image-caption" style="width:120px;">
+ <div class="image-caption">
   Test image caption
  </div>
 </div>

Modified: kupu/branch/plone-2.1/plone/tests/output/notcaptioned.out
==============================================================================
--- kupu/branch/plone-2.1/plone/tests/output/notcaptioned.out	(original)
+++ kupu/branch/plone-2.1/plone/tests/output/notcaptioned.out	Thu Jul 21 13:39:15 \
2005 @@ -1,2 +1,2 @@
 <div>Simple text containing an embedded image</div>
-<p><img class=image-left height="144" alt="picture alt text" \
src="resolveuid/104ede98d4c7c8eaeaa3b984f7395979" width="120"/></p> +<p><img \
class=image-left height="144" alt="picture alt text" src="[url for \
104ede98d4c7c8eaeaa3b984f7395979]" width="120"/></p>

Modified: kupu/branch/plone-2.1/plone/tests/output/notquoted.out
==============================================================================
--- kupu/branch/plone-2.1/plone/tests/output/notquoted.out	(original)
+++ kupu/branch/plone-2.1/plone/tests/output/notquoted.out	Thu Jul 21 13:39:15 2005
@@ -1,13 +1,13 @@
 <div>IE doesn't always quote attributes</div>
-<div class="image-left captioned">
-  <div style="width:120">
-    <img height=144 alt="picture alt text" \
src="resolveuid/104ede98d4c7c8eaeaa3b984f7395979" width=120/> +<div class="image-left \
captioned" style="width:120px;"> +  <div style="width:120px;">
+    <img height=144 alt="picture alt text" src="[url for \
104ede98d4c7c8eaeaa3b984f7395979]" width=120/>  </div>
-  <div class="image-caption" style="width:120px;">Test image caption</div>
+  <div class="image-caption">Test image caption</div>
 </div>
-<div class="captioned">
-  <div style="width:120">
-    <img height=144 alt="picture alt text" \
src="resolveuid/104ede98d4c7c8eaeaa3b984f7395979" width=120/> +<div class="captioned" \
style="width:120px;"> +  <div style="width:120px;">
+    <img height=144 alt="picture alt text" src="[url for \
104ede98d4c7c8eaeaa3b984f7395979]" width=120/>  </div>
-  <div class="image-caption" style="width:120px;">Test image caption</div>
+  <div class="image-caption">Test image caption</div>
 </div>

Modified: kupu/branch/plone-2.1/plone/tests/output/simple.out
==============================================================================
--- kupu/branch/plone-2.1/plone/tests/output/simple.out	(original)
+++ kupu/branch/plone-2.1/plone/tests/output/simple.out	Thu Jul 21 13:39:15 2005
@@ -1,6 +1,6 @@
 <div>Simple text containing an embedded image</div>
-<div class="image-left captioned">
-  <div style="width:120"><img height="144" alt="picture alt text" \
src="resolveuid/104ede98d4c7c8eaeaa3b984f7395979" width="120"/> +<div \
class="image-left captioned" style="width:120px;"> +  <div style="width:120px;"><img \
height="144" alt="picture alt text" src="[url for 104ede98d4c7c8eaeaa3b984f7395979]" \
width="120"/>  </div>
-  <div class="image-caption" style="width:120px;">Test image caption</div>
+  <div class="image-caption">Test image caption</div>
 </div>

Modified: kupu/branch/plone-2.1/plone/tests/runalltests.py
==============================================================================
--- kupu/branch/plone-2.1/plone/tests/runalltests.py	(original)
+++ kupu/branch/plone-2.1/plone/tests/runalltests.py	Thu Jul 21 13:39:15 2005
@@ -20,7 +20,6 @@
 tests = [n[:-3] for n in tests if n.startswith('test') and n.endswith('.py')]
 
 for test in tests:
-    print "***", test
     m = __import__(test)
     if hasattr(m, 'test_suite'):
         suite.addTest(m.test_suite())

Modified: kupu/branch/plone-2.1/plone/tests/runme.cmd
==============================================================================
--- kupu/branch/plone-2.1/plone/tests/runme.cmd	(original)
+++ kupu/branch/plone-2.1/plone/tests/runme.cmd	Thu Jul 21 13:39:15 2005
@@ -1,14 +1,15 @@
 @echo off
 setlocal
-set PLONEHOME=%1
+set PLONEHOME=%1"
 set PLONEHOME=%PLONEHOME:"=%
 if "%PLONEHOME%"=="" set PLONEHOME=c:\Plone20
 set PYTHONPATH=%PLONEHOME%\Zope\lib\python
 set PRODUCTS_PATH=%PLONEHOME%\Zope\lib\python\Products;%PLONEHOME%\Data\Products;%~D0%~P0..\..\..
  set INSTANCE_HOME=%PLONEHOME%\Data
 set SOFTWARE_HOME=%PLONEHOME%\Zope\lib\python
-"%PLONEHOME%\Python\python.exe" %~D0%~P0test_browserSupportsKupu.py
-"%PLONEHOME%\Python\python.exe" %~D0%~P0test_librarymanager.py
+rem "%PLONEHOME%\Python\python.exe" %~D0%~P0test_browserSupportsKupu.py %2
+rem "%PLONEHOME%\Python\python.exe" %~D0%~P0test_librarymanager.py
+rem "%PLONEHOME%\Python\python.exe" %~D0%~P0test_html2captioned.py
 rem "%PLONEHOME%\Python\python.exe" %~D0%~P0test_resourcetypemapper.py
-rem "%PLONEHOME%\Python\python.exe" %~D0%~P0runalltests.py
+"%PLONEHOME%\Python\python.exe" %~D0%~P0runalltests.py %2
 endlocal

Modified: kupu/branch/plone-2.1/plone/tests/test_browserSupportsKupu.py
==============================================================================
--- kupu/branch/plone-2.1/plone/tests/test_browserSupportsKupu.py	(original)
+++ kupu/branch/plone-2.1/plone/tests/test_browserSupportsKupu.py	Thu Jul 21 13:39:15 \
2005 @@ -13,20 +13,47 @@
 """
 
 import os, sys
+import time
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))
 
-from Testing.ZopeTestCase import installProduct
+from Testing import ZopeTestCase
 from Products.CMFPlone.tests import PloneTestCase
-installProduct('kupu')
+from Products.CMFPlone.tests.PloneTestCase import portal_name, portal_owner
+from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager
+
+def installKupu(quiet=0):
+    _start = time.time()
+    if not quiet: ZopeTestCase._print('Adding Kupu ... ')
+
+    ZopeTestCase.installProduct('kupu')
+
+    # Install kupu into the test site. Done here because otherwise
+    # it slows the tests down a lot on Plone 2.1
+    app = ZopeTestCase.app()
+    user = app.acl_users.getUserById(portal_owner).__of__(app.acl_users)
+    newSecurityManager(None, user)
+
+    portal = app[portal_name]
+    quickinstaller = portal.portal_quickinstaller
+    quickinstaller.installProduct('kupu')
+
+    # Log out
+    noSecurityManager()
+    get_transaction().commit()
+    if not quiet: ZopeTestCase._print('done (%.3fs)\n' \
+                                      % (time.time()-_start,))
+    ZopeTestCase.close(app)
+
+installKupu()
 
 class TestBrowserSupportsKupu(PloneTestCase.PloneTestCase):
 
     def afterSetUp(self):
         md = self.portal.portal_memberdata
         md._updateProperty('wysiwyg_editor', 'Kupu')
-        self.qi = self.portal.portal_quickinstaller
-        self.qi.installProduct('kupu')
+        #self.qi = self.portal.portal_quickinstaller
+        #self.qi.installProduct('kupu')
         #self.script = self.portal.portal_skins.kupu_plone.browserSupportsKupu
         self.script = self.portal.kupu_library_tool.isKupuEnabled
 

Modified: kupu/branch/plone-2.1/plone/tests/test_html2captioned.py
==============================================================================
--- kupu/branch/plone-2.1/plone/tests/test_html2captioned.py	(original)
+++ kupu/branch/plone-2.1/plone/tests/test_html2captioned.py	Thu Jul 21 13:39:15 2005
@@ -3,16 +3,17 @@
     execfile(os.path.join(sys.path[0], 'framework.py'))
 
 from unittest  import TestCase, TestSuite, main, makeSuite
+from Products.CMFPlone.tests import PloneTestCase
 from os.path import join, abspath, dirname
 
-try:
-    import Zope # Sigh, make product initialization happen
-    HAS_ZOPE = 1
-    Zope.startup()
-except ImportError:
-    HAS_ZOPE = 0
-except AttributeError: # Zope > 2.6
-    pass
+#try:
+#    import Zope # Sigh, make product initialization happen
+#    HAS_ZOPE = 1
+#    Zope.startup()
+#except ImportError:
+#    HAS_ZOPE = 0
+#except AttributeError: # Zope > 2.6
+#    pass
 
 from Products.PortalTransforms.tests.test_transforms import *
 from Products.PortalTransforms.tests.utils import normalize_html
@@ -39,6 +40,8 @@
         self.uid, self.description = uid, description
     def Description(self):
         return self.description
+    def absolute_url(self):
+        return '[url for %s]' % self.uid
 
 class MockCatalogTool:
     def lookupObject(self, uid):

Modified: kupu/branch/plone-2.1/plone/tests/test_resourcetypemapper.py
==============================================================================
--- kupu/branch/plone-2.1/plone/tests/test_resourcetypemapper.py	(original)
+++ kupu/branch/plone-2.1/plone/tests/test_resourcetypemapper.py	Thu Jul 21 13:39:15 \
2005 @@ -16,17 +16,37 @@
 if __name__ == '__main__':
     execfile(os.path.join(sys.path[0], 'framework.py'))
 
+import Acquisition
 from Testing.ZopeTestCase import ZopeTestCase
+# from Products.CMFPlone.tests import PloneTestCase
 from Products.kupu.plone.librarytool import KupuLibraryTool
 
+class FakeType:
+    def __init__(self, id, **kw):
+        self.id = id
+        for k in kw:
+            setattr(self, k, kw[k])
+
+class FakeTypeTool:
+    def listTypeInfo(self, container=None):
+        return [ FakeType(f)
+            for f in "Foo|Bar|Monkey|Ape|Nothing In Here Anymore|Bad Monkey|Bad \
Ape".split('|') ] +
+class FakePortal(Acquisition.Implicit):
+    absolute_url = lambda(self): None
+    portal_types = FakeTypeTool()
+
+
 class TestIResourceTypeMapper(ZopeTestCase):
     """Test the implementation of IResourceMapper in KupuLibraryTool"""
 
     def afterSetUp(self):
+        self.portal = FakePortal()
         self.type_map = self.prepare()
 
     def prepare(self):
         type_map = KupuLibraryTool()
+        type_map = type_map.__of__(self.portal)
         type_map.addResourceType("foobar", ("Foo", "", "Bar"))
         type_map.addResourceType("bonobo", ("Monkey", " Ape\n"))
         return type_map

Modified: kupu/branch/plone-2.1/silva/kupusilvatools.js
==============================================================================
--- kupu/branch/plone-2.1/silva/kupusilvatools.js	(original)
+++ kupu/branch/plone-2.1/silva/kupusilvatools.js	Thu Jul 21 13:39:15 2005
@@ -1792,7 +1792,7 @@
             handler.call(this, this._url);
             return;
         };
-        var request = Sarissa.getXmlHttpRequest();
+        var request = new getXMLHttpRequest();
         request.open('GET', 
             this._baseurl + '/edit/get_extsource_url?id=' + id, true);
         var callback = new ContextFixer(function() {
@@ -1816,7 +1816,7 @@
             // validate the data and take further actions
             var formdata = this._gatherFormData();
             var doc = window.document;
-            var request = Sarissa.getXmlHttpRequest();
+            var request = new XMLHttpRequest();
             request.open('POST', this._url + '/validate_form_to_request', true);
             var callback = new ContextFixer(this._addExternalSourceIfValidated, \
request, this);  request.onreadystatechange = callback.execute;
@@ -1827,7 +1827,7 @@
 
     this._continueStartExternalSourceEdit = function(url) {
         url = url + '/get_rendered_form_for_editor?docref=' + this.docref;
-        var request = Sarissa.getXmlHttpRequest();
+        var request = new XMLHttpRequest();
         request.open('GET', url, true);
         var callback = new ContextFixer(this._addFormToTool, request, this);
         request.onreadystatechange = callback.execute;
@@ -1852,7 +1852,7 @@
         url = url + '/get_rendered_form_for_editor';
         var formdata = this._gatherFormDataFromElement();
         formdata += '&docref=' + this.docref;
-        var request = Sarissa.getXmlHttpRequest();
+        var request = new XMLHttpRequest();
         request.open('POST', url, true);
         request.setRequestHeader('Content-Type', \
                'application/x-www-form-urlencoded');
         var callback = new ContextFixer(this._addFormToTool, request, this);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic