[kupu-checkins] r38550 - in kupu/trunk/kupu: Extensions plone plone/tests
duncan at codespeak.net
duncan at codespeak.net
Mon Feb 12 13:29:45 CET 2007
Author: duncan
Date: Mon Feb 12 13:29:43 2007
New Revision: 38550
Modified:
kupu/trunk/kupu/Extensions/Install.py
kupu/trunk/kupu/plone/html2captioned.py
kupu/trunk/kupu/plone/plonedrawers.py
kupu/trunk/kupu/plone/tests/framework.py
kupu/trunk/kupu/plone/util.py
Log:
Make tests work again (at least on older Plones):
Added installProduct('kupu') so we can create a test site
Let Install.py work if ResourceRegistries is present but not installed.
Fix html2captioned (broke a test and hadn't noticed)
remove_transform needs to be robust against no transform tool.
Modified: kupu/trunk/kupu/Extensions/Install.py
==============================================================================
--- kupu/trunk/kupu/Extensions/Install.py (original)
+++ kupu/trunk/kupu/Extensions/Install.py Mon Feb 12 13:29:43 2007
@@ -96,8 +96,10 @@
data = _read_resources()
CONDITION = '''python:portal.kupu_library_tool.isKupuEnabled(REQUEST=request)'''
- csstool = getToolByName(self, CSSTOOLNAME)
- jstool = getToolByName(self, JSTOOLNAME)
+ csstool = getToolByName(self, CSSTOOLNAME, None)
+ jstool = getToolByName(self, JSTOOLNAME, None)
+ if csstool is None or jstool is None:
+ return
for id in css_files(data):
print >>out, "CSS file", id
Modified: kupu/trunk/kupu/plone/html2captioned.py
==============================================================================
--- kupu/trunk/kupu/plone/html2captioned.py (original)
+++ kupu/trunk/kupu/plone/html2captioned.py Mon Feb 12 13:29:43 2007
@@ -138,10 +138,10 @@
d['tag'] = tag
if not width and srctail:
subtarget = getattr(target, srctail, None)
- try:
- width = subtarget.width
- except AttributeError:
- pass
+ if hasattr(aq_base(subtarget), 'getWidth'):
+ width = subtarget.getWidth()
+ elif hasattr(aq_base(subtarget), 'width'):
+ width = subtarget.getWidth()
if not width:
try:
width = target.getWidth()
Modified: kupu/trunk/kupu/plone/plonedrawers.py
==============================================================================
--- kupu/trunk/kupu/plone/plonedrawers.py (original)
+++ kupu/trunk/kupu/plone/plonedrawers.py Mon Feb 12 13:29:43 2007
@@ -390,7 +390,7 @@
icon = self.icon(portal_type)
size, width, height = self.sizes(brain)
- title = brain.Title or brain.getId
+ title = (brain.Title or brain.getId).translate(NOCC)
description = newline_to_br(html_quote(brain.Description))
linkable = None
if allowLink:
Modified: kupu/trunk/kupu/plone/tests/framework.py
==============================================================================
--- kupu/trunk/kupu/plone/tests/framework.py (original)
+++ kupu/trunk/kupu/plone/tests/framework.py Mon Feb 12 13:29:43 2007
@@ -104,4 +104,5 @@
print 'SOFTWARE_HOME: %s' % os.environ.get('SOFTWARE_HOME', 'Not set')
print 'INSTANCE_HOME: %s' % os.environ.get('INSTANCE_HOME', 'Not set')
sys.stdout.flush()
-
+from Testing import ZopeTestCase
+ZopeTestCase.installProduct('kupu')
Modified: kupu/trunk/kupu/plone/util.py
==============================================================================
--- kupu/trunk/kupu/plone/util.py (original)
+++ kupu/trunk/kupu/plone/util.py Mon Feb 12 13:29:43 2007
@@ -106,7 +106,9 @@
def remove_transform(self):
"""Disable the UID transform: remove the policy but leave everything else intact."""
- transform_tool = getToolByName(self, 'portal_transforms')
+ transform_tool = getToolByName(self, 'portal_transforms', None)
+ if transform_tool is None:
+ return
policies = [ (mimetype, required) for (mimetype, required) in transform_tool.listPolicies() if mimetype==MT_SAFE ]
if not policies:
return
More information about the kupu-checkins
mailing list