r667 - in zope-archetypes/trunk: Archetypes
Archetypes/skins/archetypes Archetypes/skins/archetypes/widgets
Archetypes/skins/archetypes/widgets/js Archetypes/tests
PortalTransforms PortalTransforms/tests/output
PortalTransforms/transforms debian validation validation/validators
Fabio Tranchitella
kobold at alioth.debian.org
Fri Feb 9 15:52:51 CET 2007
Author: kobold
Date: 2007-02-09 15:52:51 +0100 (Fri, 09 Feb 2007)
New Revision: 667
Added:
zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/js/inandout.js.metadata
zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/js/picklist.js.metadata
zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/js/textcount.js.metadata
zope-archetypes/trunk/Archetypes/tests/layer.py
Modified:
zope-archetypes/trunk/Archetypes/AllowedTypesByIface.py
zope-archetypes/trunk/Archetypes/BaseObject.py
zope-archetypes/trunk/Archetypes/CatalogMultiplex.py
zope-archetypes/trunk/Archetypes/Field.py
zope-archetypes/trunk/Archetypes/HISTORY.txt
zope-archetypes/trunk/Archetypes/ReferenceEngine.py
zope-archetypes/trunk/Archetypes/Referenceable.py
zope-archetypes/trunk/Archetypes/UIDCatalog.py
zope-archetypes/trunk/Archetypes/Widget.py
zope-archetypes/trunk/Archetypes/skins/archetypes/edit_macros.pt
zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/calendar.pt
zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/multiselection.pt
zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/visual.pt
zope-archetypes/trunk/Archetypes/tests/atsitetestcase.py
zope-archetypes/trunk/Archetypes/tests/test_filename.py
zope-archetypes/trunk/Archetypes/tests/test_rename.py
zope-archetypes/trunk/Archetypes/version.txt
zope-archetypes/trunk/PortalTransforms/HISTORY.txt
zope-archetypes/trunk/PortalTransforms/chain.py
zope-archetypes/trunk/PortalTransforms/tests/output/rest2.out
zope-archetypes/trunk/PortalTransforms/tests/output/rest3.out
zope-archetypes/trunk/PortalTransforms/transforms/broken.py
zope-archetypes/trunk/PortalTransforms/transforms/rest.py
zope-archetypes/trunk/PortalTransforms/transforms/safe_html.py
zope-archetypes/trunk/PortalTransforms/utils.py
zope-archetypes/trunk/PortalTransforms/version.txt
zope-archetypes/trunk/debian/changelog
zope-archetypes/trunk/validation/HISTORY.txt
zope-archetypes/trunk/validation/validators/ExpressionValidator.py
zope-archetypes/trunk/validation/validators/RegexValidator.py
zope-archetypes/trunk/validation/version.txt
Log:
New upstream release.
Modified: zope-archetypes/trunk/Archetypes/AllowedTypesByIface.py
===================================================================
--- zope-archetypes/trunk/Archetypes/AllowedTypesByIface.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/AllowedTypesByIface.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -135,6 +135,8 @@
tmp_name = '%s_TMP' % self.portal_type
ti = pt.getTypeInfo(self.portal_type)
pt.manage_delObjects([self.portal_type])
- value = BaseFolder._verifyObjectPaste(self, object, validate_src)
- pt._setObject(self.portal_type, ti)
+ try:
+ value = BaseFolder._verifyObjectPaste(self, object, validate_src)
+ finally:
+ pt._setObject(self.portal_type, ti)
return value
Modified: zope-archetypes/trunk/Archetypes/BaseObject.py
===================================================================
--- zope-archetypes/trunk/Archetypes/BaseObject.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/BaseObject.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -275,9 +275,10 @@
def isBinary(self, key):
"""Return wether a field contains binary data.
"""
- element = getattr(self, key, None)
- if element and shasattr(element, 'isBinary'):
- return element.isBinary()
+ field = self.getField(key)
+ if IFileField.isImplementedBy(field):
+ value = field.getBaseUnit(self)
+ return value.isBinary()
mimetype = self.getContentType(key)
if mimetype and shasattr(mimetype, 'binary'):
return mimetype.binary
@@ -649,12 +650,12 @@
# Post create/edit hooks
if is_new_object:
- event.notify(objectevent.ObjectCreatedEvent(self))
self.at_post_create_script()
else:
- event.notify(objectevent.ObjectModifiedEvent(self))
self.at_post_edit_script()
+ event.notify(objectevent.ObjectModifiedEvent(self))
+
# This method is only called once after object creation.
security.declarePrivate('at_post_create_script')
def at_post_create_script(self):
@@ -760,16 +761,20 @@
RENAME_AFTER_CREATION_ATTEMPTS, set in config.py. If no id can be
found, return None.
"""
- parent = aq_parent(aq_inner(self))
- parent_ids = parent.objectIds()
+ check_id = getattr(self, 'check_id', None)
+ if check_id is None:
+ parent = aq_parent(aq_inner(self))
+ parent_ids = parent.objectIds()
+ check_id = lambda id, required: id in parent_ids
- if id not in parent_ids:
+ invalid_id = check_id(id, required=1)
+ if not invalid_id:
return id
idx = 1
while idx <= RENAME_AFTER_CREATION_ATTEMPTS:
new_id = "%s-%d" % (id, idx)
- if new_id not in parent_ids:
+ if not check_id(new_id, required=1):
return new_id
idx += 1
Modified: zope-archetypes/trunk/Archetypes/CatalogMultiplex.py
===================================================================
--- zope-archetypes/trunk/Archetypes/CatalogMultiplex.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/CatalogMultiplex.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -1,3 +1,5 @@
+from debug import log
+from logging import WARNING
from Globals import InitializeClass
from Acquisition import aq_base
from AccessControl import ClassSecurityInfo
@@ -38,7 +40,8 @@
catalogs = self.getCatalogs()
url = self.__url()
for c in catalogs:
- c.uncatalog_object(url)
+ if c._catalog.uids.get(url, None) is not None:
+ c.uncatalog_object(url)
security.declareProtected(ModifyPortalContent, 'reindexObjectSecurity')
def reindexObjectSecurity(self, skip_self=False):
@@ -68,8 +71,8 @@
# BBB: Ignore old references to deleted objects.
# Can happen only in Zope 2.7, or when using
# catalog-getObject-raises off in Zope 2.8
- LOG('reindexObjectSecurity', PROBLEM,
- "Cannot get %s from catalog" % brain_path)
+ log("reindexObjectSecurity: Cannot get %s from catalog" %
+ brain_path, level=WARNING)
continue
# Recatalog with the same catalog uid.
Modified: zope-archetypes/trunk/Archetypes/Field.py
===================================================================
--- zope-archetypes/trunk/Archetypes/Field.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/Field.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -1088,7 +1088,7 @@
def setFilename(self, instance, filename):
"""Set file name in the base unit.
"""
- bu = self.getBaseUnit(instance)
+ bu = self.getBaseUnit(instance, full=True)
bu.setFilename(filename)
self.set(instance, bu)
@@ -1299,7 +1299,7 @@
return data or ''
security.declarePrivate('getBaseUnit')
- def getBaseUnit(self, instance):
+ def getBaseUnit(self, instance, full=False):
"""Return the value of the field wrapped in a base unit object
"""
return self.get(instance, raw=True)
@@ -1499,7 +1499,8 @@
# * the locale settings of the zope-server, Plone, logged in user
# * maybe the locale of the browser sending the value.
# same should happen with the output.
- value = value.replace(',','.')
+ if type(value) in StringTypes:
+ value = value.replace(',','.')
value = value.split('.')
__traceback_info__ = (self, value)
Modified: zope-archetypes/trunk/Archetypes/HISTORY.txt
===================================================================
--- zope-archetypes/trunk/Archetypes/HISTORY.txt 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/HISTORY.txt 2007-02-09 14:52:51 UTC (rev 667)
@@ -1,6 +1,55 @@
+1.4.2-final - 2006-12-15
+========================
+ * Fixzd missing declaration of timestamp property in TextAreaWidget for
+ append_only mode.
+ It may need a better intregration of plone datetime format property.
+ [encolpe]
+
+ * Fixed missing i18n statement for the text format label on visual widgets.
+ This closes http://dev.plone.org/archetypes/ticket/687.
+ [hannosch]
+
+ * Fixed a minor issue of FixedPointField: It now works with integer default
+ value.
+ [jensens]
+
+ * Add a try: finally: clause in AllowedTypesByIfaceMixin when deleting
+ the typeinfo "temporarily" Fixes http://dev.plone.org/plone/ticket/5314
+ [alecm]
+
+ * Fix the unique name finder during initial rename on create so that it
+ checks the names validity. Fixes http://dev.plone.org/plone/ticket/5044
+ [alecm]
+
+ * Fix BaseObject.isBinary to not assume AttributeStorage. Fixes
+ http://dev.plone.org/plone/ticket/5822
+ [alecm]
+
+ * Silenced more catalog unindexing log error messages by checking if
+ an object exists in the catalog before uncataloging.
+ [rocky]
+
+ * Fixed #5963. Now all the first headers of the page have
+ "documentFirstHeading" class applied.
+ http://dev.plone.org/plone/ticket/5963
+ [spliter]
+
+ * Fixed #5929. UID catalog rebuild broke path convention.
+ http://dev.plone.org/plone/ticket/5929.
+ [hannosch]
+
+ * Made tests use layers for AT site setup.
+ [stefan]
+
1.4.1-final - 2006-09-08
========================
+ * Fix #635. Large files were truncated on `setFileName`. In
+ `setFilename` of FileField, we now set the `filename` attribute
+ directly instead of retrieving the BaseObject, setting the
+ filename and setting the object again.
+ [nouri]
+
* Fixed log_exc function in debug.py to print the actual exception including
the traceback.
[hannosch]
@@ -47,10 +96,6 @@
just a name change without any real benefit.
[hannosch]
- * Fixed import of NotFound in getBestIcon.py which broke CMF1.4 compatibility.
- This closes http://dev.plone.org/archetypes/ticket/656.
- [hannosch]
-
1.4.0-RC1 - 2006-06-02
======================
@@ -75,11 +120,6 @@
This closes http://dev.plone.org/plone/ticket/5214.
[hannosch]
- * Add a new generateNewId method to BaseObject which is used to suggest
- a new id when automatically renaming an object after creation. This makes
- it easier to used custom naming in derived types.
- [wichert]
-
* Add GenericSetup support for importing/exporting the catalog map from
ArchetypeTool
[wichert]
@@ -88,10 +128,6 @@
to config.py to switch back to the old behaviour.
[wichert]
- * Check mimetype before schema update and reapply type after. This fixes
- https://dev.plone.org/archetypes/ticket/618
- [alecm]
-
* Removed some old commented out code.
[hannosch]
@@ -228,6 +264,30 @@
needed to handle zope.i18nmessageid.MessageID objects correctly.
[hannosch]
+1.3.10-final2 - 2006-09-14
+==========================
+
+ * Check mimetype before schema update and reapply type after. This fixes
+ https://dev.plone.org/archetypes/ticket/618
+ [alecm]
+
+ * Fixed import of NotFound in getBestIcon.py which broke CMF1.4 compatibility.
+ This closes http://dev.plone.org/archetypes/ticket/656.
+ [hannosch]
+
+1.3.9-final - 2006-05-16
+========================
+
+ * Add a new generateNewId method to BaseObject which is used to suggest
+ a new id when automatically renaming an object after creation. This makes
+ it easier to used custom naming in derived types.
+ [wichert]
+
+ * Fix visual widget to not lose formatting if there's only one allowed
+ content type - without passing this variable along, the field will revert
+ to text/plain or MIME type guessing the second time it's saved.
+ [optilude]
+
1.3.8-final - 2006-04-30
========================
@@ -1711,3 +1771,4 @@
* Fixed [ 988898 ] Don't swallow ConflictError (SQL missing)
[tiran]
+
Modified: zope-archetypes/trunk/Archetypes/ReferenceEngine.py
===================================================================
--- zope-archetypes/trunk/Archetypes/ReferenceEngine.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/ReferenceEngine.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -627,9 +627,7 @@
c_elapse = time.clock()
atool = getToolByName(self, TOOL_NAME)
- func = self.catalog_object
obj = aq_parent(self)
- path = '/'.join(obj.getPhysicalPath())
if not REQUEST:
REQUEST = self.REQUEST
Modified: zope-archetypes/trunk/Archetypes/Referenceable.py
===================================================================
--- zope-archetypes/trunk/Archetypes/Referenceable.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/Referenceable.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -294,7 +294,8 @@
if not uc:
uc = getToolByName(self, config.UID_CATALOG)
url = self._getURL()
- uc.uncatalog_object(url)
+ if uc._catalog.uids.get(url, None) is not None:
+ uc.uncatalog_object(url)
def _catalogRefs(self, aq, uc=None, rc=None):
Modified: zope-archetypes/trunk/Archetypes/UIDCatalog.py
===================================================================
--- zope-archetypes/trunk/Archetypes/UIDCatalog.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/UIDCatalog.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -2,6 +2,7 @@
import sys
import time
import urllib
+import traceback
from Globals import InitializeClass
from Globals import DTMLFile
from ExtensionClass import Base
@@ -20,6 +21,7 @@
from Products.Archetypes.config import TOOL_NAME
from Products.Archetypes.debug import log
from Products.Archetypes.interfaces.referenceengine import IUIDCatalog
+from Products.Archetypes.utils import getRelURL
_catalog_dtml = os.path.join(os.path.dirname(CMFCore.__file__), 'dtml')
@@ -102,7 +104,7 @@
raise
except:
log('UIDCatalogBrains getObject raised an error:\n %s' %
- sys.exc_info())
+ '\n'.join(traceback.format_exception(*sys.exc_info())))
pass
InitializeClass(UIDCatalogBrains)
@@ -218,6 +220,13 @@
except TypeError:
ZCatalog.catalog_object(self, w, uid, idxs)
+ def _catalogObject(self, obj, path):
+ """Catalog the object. The object will be cataloged with the absolute
+ path in case we don't pass the relative url.
+ """
+ url = getRelURL(self, obj.getPhysicalPath())
+ self.catalog_object(obj, url)
+
security.declareProtected(CMFCore.permissions.ManagePortal, 'manage_rebuildCatalog')
def manage_rebuildCatalog(self, REQUEST=None, RESPONSE=None):
"""
@@ -226,7 +235,6 @@
c_elapse = time.clock()
atool = getToolByName(self, TOOL_NAME)
- func = self.catalog_object
obj = aq_parent(self)
path = '/'.join(obj.getPhysicalPath())
if not REQUEST:
@@ -243,7 +251,7 @@
obj_metatypes=mt,
search_sub=1,
REQUEST=REQUEST,
- apply_func=func,
+ apply_func=self._catalogObject,
apply_path=path)
elapse = time.time() - elapse
@@ -259,4 +267,3 @@
% (`elapse`, `c_elapse`))
)
-
Modified: zope-archetypes/trunk/Archetypes/Widget.py
===================================================================
--- zope-archetypes/trunk/Archetypes/Widget.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/Widget.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -327,6 +327,7 @@
'format': 0,
'append_only': False,
'divider':"\n\n========================\n\n",
+ 'timestamp': True,
'maxlength' : False,
'helper_js': ('widgets/js/textcount.js',),
})
@@ -900,6 +901,7 @@
registerPropertyType('cols', 'integer', TextAreaWidget)
registerPropertyType('append_only', 'boolean', TextAreaWidget)
registerPropertyType('divider', 'string', TextAreaWidget)
+registerPropertyType('timestamp', 'boolean', TextAreaWidget)
registerPropertyType('rows', 'integer', LinesWidget)
registerPropertyType('cols', 'integer', LinesWidget)
registerPropertyType('rows', 'integer', VisualWidget)
Modified: zope-archetypes/trunk/Archetypes/skins/archetypes/edit_macros.pt
===================================================================
--- zope-archetypes/trunk/Archetypes/skins/archetypes/edit_macros.pt 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/skins/archetypes/edit_macros.pt 2007-02-09 14:52:51 UTC (rev 667)
@@ -13,7 +13,7 @@
Document actions (print, sendto etc)
</div>
- <h1 i18n:translate="heading_edit_item"
+ <h1 i18n:translate="heading_edit_item" class="documentFirstHeading"
metal:define-slot="title">
Edit
<span i18n:name="itemtype"
Modified: zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/calendar.pt
===================================================================
--- zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/calendar.pt 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/calendar.pt 2007-02-09 14:52:51 UTC (rev 667)
@@ -25,6 +25,9 @@
<tal:define define="id fieldName;
show_hm widget/show_hm|nothing;
show_ymd widget/show_ymd|nothing;
+ starting_year widget/starting_year|nothing;
+ ending_year widget/ending_year|nothing;
+ future_years widget/future_years|nothing;
inputname fieldName;
formname string:edit_form;
inputvalue python:test(value!='None', value, '');">
Copied: zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/js/inandout.js.metadata (from rev 647, zope-archetypes/branches/upstream/current/Archetypes/skins/archetypes/widgets/js/inandout.js.metadata)
Copied: zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/js/picklist.js.metadata (from rev 647, zope-archetypes/branches/upstream/current/Archetypes/skins/archetypes/widgets/js/picklist.js.metadata)
Copied: zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/js/textcount.js.metadata (from rev 647, zope-archetypes/branches/upstream/current/Archetypes/skins/archetypes/widgets/js/textcount.js.metadata)
Modified: zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/multiselection.pt
===================================================================
--- zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/multiselection.pt 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/multiselection.pt 2007-02-09 14:52:51 UTC (rev 667)
@@ -28,18 +28,19 @@
<span tal:repeat="item vocab" tal:omit-tag=""
tal:condition="python:format=='checkbox'">
<tal:block tal:define="tabindex tabindex/next">
+ <div class="ArchetypesMultiSelectionValue" id=""
+ tal:attributes="id string:archetypes-value-${fieldName}_${repeat/item/number}">
<input
tal:attributes="type string:checkbox;
name string:$fieldName:list;
id string:${fieldName}_${repeat/item/number};
tabindex tabindex;
checked python:test(here.unicodeTestIn(item, value), 'checked', None);
- value nocall:item;"
- />
+ value nocall:item;"/>
<label tal:content="python:here.translate(vocab.getMsgId(item), default=vocab.getValue(item))"
i18n:translate=""
tal:attributes="for string:${fieldName}_${repeat/item/number}" />
- <br />
+ </div>
</tal:block>
</span>
Modified: zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/visual.pt
===================================================================
--- zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/visual.pt 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/skins/archetypes/widgets/visual.pt 2007-02-09 14:52:51 UTC (rev 667)
@@ -34,7 +34,7 @@
mimetypes python: allowableContentTypes + (fieldCType not in allowableContentTypes and [fieldCType] or []);">
<div class="fieldTextFormat" tal:condition="python: len(mimetypes) > 1">
- <label>Text Format</label>
+ <label i18n:translate="label_text_format">Text Format</label>
<select tal:attributes="
id string:${fieldName}_text_format;
Modified: zope-archetypes/trunk/Archetypes/tests/atsitetestcase.py
===================================================================
--- zope-archetypes/trunk/Archetypes/tests/atsitetestcase.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/tests/atsitetestcase.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -28,7 +28,8 @@
from Testing import ZopeTestCase
-from Testing.ZopeTestCase.functional import Functional
+from Testing.ZopeTestCase import Functional
+from Testing.ZopeTestCase import utils
from Products.Archetypes.tests import attestcase
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
@@ -36,25 +37,24 @@
import transaction
import sys, code
-USELAYER=False
-
if not attestcase.USE_PLONETESTCASE:
from Products.CMFTestCase import CMFTestCase
from Products.CMFTestCase.setup import portal_name
from Products.CMFTestCase.setup import portal_owner
+ from Products.CMFTestCase.setup import USELAYER
# setup a CMF site
CMFTestCase.setupCMFSite()
PortalTestClass = CMFTestCase.CMFTestCase
else:
- import Products.PloneTestCase.setup
from Products.PloneTestCase import PloneTestCase
from Products.PloneTestCase.setup import portal_name
from Products.PloneTestCase.setup import portal_owner
+ from Products.PloneTestCase.setup import USELAYER
# setup a Plone site
PloneTestCase.setupPloneSite()
PortalTestClass = PloneTestCase.PloneTestCase
- USELAYER = Products.PloneTestCase.setup.USELAYER
+
class ATSiteTestCase(PortalTestClass, attestcase.ATTestCase):
"""AT test case inside a CMF site
"""
@@ -62,6 +62,11 @@
__implements__ = PortalTestClass.__implements__ + \
attestcase.ATTestCase.__implements__
+ if USELAYER:
+ import layer
+ layer = layer.ATSite
+
+
class ATFunctionalSiteTestCase(Functional, ATSiteTestCase):
"""AT test case for functional tests inside a CMF site
"""
@@ -94,6 +99,7 @@
sys.stdout.write('='*70+'\n')
sys.stdout = savestdout
+
###
# Setup an archetypes site
###
@@ -163,15 +169,11 @@
transaction.commit()
if not quiet: ZopeTestCase._print('done (%.3fs)\n' % (time.time()-_start,))
-if USELAYER:
- from Products.PloneTestCase.utils import safe_load_site_wrapper
- setupArchetypes = safe_load_site_wrapper(setupArchetypes)
-# Install Archetypes
-# XXX replace with layer
-app = ZopeTestCase.app()
-setupArchetypes(app)
-ZopeTestCase.close(app)
+if not USELAYER:
+ # Install Archetypes
+ utils.appcall(setupArchetypes)
+
__all__ = ('ATSiteTestCase', 'ATFunctionalSiteTestCase', 'portal_name',
'portal_owner')
Copied: zope-archetypes/trunk/Archetypes/tests/layer.py (from rev 647, zope-archetypes/branches/upstream/current/Archetypes/tests/layer.py)
Modified: zope-archetypes/trunk/Archetypes/tests/test_filename.py
===================================================================
--- zope-archetypes/trunk/Archetypes/tests/test_filename.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/tests/test_filename.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -30,6 +30,9 @@
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
+from StringIO import StringIO
+import transaction
+
from Testing import ZopeTestCase
from Products.Archetypes.tests.atsitetestcase import ATSiteTestCase
@@ -165,6 +168,20 @@
self.assertEqual(field1.getFilename(obj), filename1)
self.assertEqual(field2.getFilename(obj), filename2)
+
+class LargeFileTest(ATSiteTestCase):
+ def testSetFilenameOfLargeFile(self):
+ """Test for https://dev.plone.org/archetypes/ticket/635
+ """
+ self.folder.invokeFactory('SimpleFile', 'sf')
+ obj = self.folder.sf
+ contents = StringIO('largest file, ' * 10000)
+ obj.setBody(contents)
+ self.assertEqual(obj.getBody().size, 140000)
+ obj.getBody().setFilename('Spam.txt')
+ self.assertEqual(obj.getBody().size, 140000)
+
+
class StrangeIdTest(ATSiteTestCase):
def test_strangeUnallowedIds(self):
""" Certain IDs used to give an error and are unusable
@@ -185,6 +202,7 @@
suite = TestSuite()
suite.addTest(makeSuite(GetFilenameTest))
suite.addTest(makeSuite(SetFilenameTest))
+ suite.addTest(makeSuite(LargeFileTest))
suite.addTest(makeSuite(StrangeIdTest))
return suite
Modified: zope-archetypes/trunk/Archetypes/tests/test_rename.py
===================================================================
--- zope-archetypes/trunk/Archetypes/tests/test_rename.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/tests/test_rename.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -26,7 +26,7 @@
"""
Unittests for a renaming archetypes objects.
-$Id: test_rename.py 5448 2006-01-06 18:34:27Z alecm $
+$Id: test_rename.py 7182 2006-11-22 22:33:43Z shh42 $
"""
import os, sys
@@ -50,6 +50,12 @@
import transaction
+try:
+ from OFS import subscribers
+ HAS_EVENTS = True
+except ImportError:
+ HAS_EVENTS = False
+
class Counter:
def __init__(self):
@@ -177,7 +183,16 @@
# Rename the parent folder
self.folder.folder2.folder22.manage_renameObject('folder221',
'new_folder221')
- expected = (d_count[0]+1, d_count[1]+1, d_count[2]+0)
+
+ # BBB: We have both manage_* methods and events being fired in Zope 2.9,
+ # so we get some higher counts as usually expected. But as we cannot do
+ # anything about it, we have to live with the fact for now. In
+ # Archetypes 1.5 this problem has been fixed already.
+ if HAS_EVENTS:
+ expected = (d_count[0]+2, d_count[1]+2, d_count[2]+0)
+ else:
+ expected = (d_count[0]+1, d_count[1]+1, d_count[2]+0)
+
got = self.getCounts(d)
self.assertEquals(got, expected)
@@ -187,7 +202,15 @@
# Rename the root folder
self.folder.manage_renameObject('folder2', 'new_folder2')
- expected = (d_count[0]+1, d_count[1]+1, d_count[2]+0)
+ # BBB: We have both manage_* methods and events being fired in Zope 2.9,
+ # so we get some higher counts as usually expected. But as we cannot do
+ # anything about it, we have to live with the fact for now. In
+ # Archetypes 1.5 this problem has been fixed already.
+ if HAS_EVENTS:
+ expected = (d_count[0]+4, d_count[1]+4, d_count[2]+0)
+ else:
+ expected = (d_count[0]+1, d_count[1]+1, d_count[2]+0)
+
got = self.getCounts(d)
self.assertEquals(got, expected)
@@ -208,8 +231,17 @@
got = self.getCounts(new_d)
# Should have called manage_afterAdd and manage_afterClone for
# the *new* object.
- self.assertEquals(got, (1, 0, 1))
+ # BBB: We have both manage_* methods and events being fired in Zope 2.9,
+ # so we get some higher counts as usually expected. But as we cannot do
+ # anything about it, we have to live with the fact for now. In
+ # Archetypes 1.5 this problem has been fixed already.
+ if HAS_EVENTS:
+ self.assertEquals(got, (1, 0, 4))
+ else:
+ self.assertEquals(got, (1, 0, 1))
+
+
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
Modified: zope-archetypes/trunk/Archetypes/version.txt
===================================================================
--- zope-archetypes/trunk/Archetypes/version.txt 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/Archetypes/version.txt 2007-02-09 14:52:51 UTC (rev 667)
@@ -1 +1 @@
-1.4.1-final
\ No newline at end of file
+1.4.2-final
\ No newline at end of file
Modified: zope-archetypes/trunk/PortalTransforms/HISTORY.txt
===================================================================
--- zope-archetypes/trunk/PortalTransforms/HISTORY.txt 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/PortalTransforms/HISTORY.txt 2007-02-09 14:52:51 UTC (rev 667)
@@ -1,3 +1,27 @@
+1.5.0-final - 2006-12-15
+========================
+
+ * note for release-managers: The version-bump to 1.5 was a bit early, but now
+ as we have it, i keep it and next release number in the cycle needed for
+ Archetypes 1.4.2 (used for Plone 2.5.2) of PortalTransforms is then the 1.5
+ final.
+ We dont need increasing of release numbers because of Plone 3.0,
+ Archetypes 1.5, ... if theres no change in the dependen product, like
+ this one.
+ [jensens]
+
+1.5.0-a1 - 2006-10-25
+=====================
+
+ * casting to int is evil without previous check of the type. so we assume as
+ in CMFPlone just zero for non-int-castable values.
+ [jensens]
+
+ * the values in the safe_html valid tag dictionary can become strings when
+ modifying them via the ZMI. Explicitly convert them to integers before
+ testing their value.
+ [wichert]
+
1.4.1-final - 2006-09-08
========================
Modified: zope-archetypes/trunk/PortalTransforms/chain.py
===================================================================
--- zope-archetypes/trunk/PortalTransforms/chain.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/PortalTransforms/chain.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -87,6 +87,7 @@
It follows the transform API so that a chain is itself a transform.
"""
+ module = 'N/A'
meta_type = 'TransformsChain'
meta_types = all_meta_types = ()
@@ -112,15 +113,6 @@
self.output = 'application/octet-stream'
self._chain = None
- def __setstate__(self, state):
- """ __setstate__ is called whenever the instance is loaded
- from the ZODB, like when Zope is restarted.
-
- We should rebuild the chain at this time
- """
- TransformsChain.inheritedAttribute('__setstate__')(self, state)
- self._chain = None
-
def _chain_init(self):
""" build the transforms chain """
tr_tool = getToolByName(self, 'portal_transforms')
@@ -208,8 +200,8 @@
""" reload the module where the transformation class is defined """
for tr in self.objectValues():
tr.reload()
+ self._chain_init()
-
# utilities #
security.declareProtected(ManagePortal, 'listAddableObjectIds')
Modified: zope-archetypes/trunk/PortalTransforms/tests/output/rest2.out
===================================================================
--- zope-archetypes/trunk/PortalTransforms/tests/output/rest2.out 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/PortalTransforms/tests/output/rest2.out 2007-02-09 14:52:51 UTC (rev 667)
@@ -1,6 +1,6 @@
<h2 class="title">Heading 1</h2>
<p>Some text.</p>
-<div class="section" id="heading-2">
-<h3><a name="heading-2">Heading 2</a></h3>
+<div class="section">
+<h3><a id="heading-2" name="heading-2">Heading 2</a></h3>
<p>Some text, bla ble bli blo blu. Yes, i know this is <a class="reference" href="http://www.example.com">Stupid</a>.</p>
</div>
Modified: zope-archetypes/trunk/PortalTransforms/tests/output/rest3.out
===================================================================
--- zope-archetypes/trunk/PortalTransforms/tests/output/rest3.out 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/PortalTransforms/tests/output/rest3.out 2007-02-09 14:52:51 UTC (rev 667)
@@ -1,11 +1,11 @@
<h2 class="title">Title</h2>
<h3 class="subtitle">Subtitle</h3>
<p>This is a test document to make sure subtitle gets the right heading.</p>
-<div class="section" id="now-the-real-heading">
-<h3><a name="now-the-real-heading">Now the real heading</a></h3>
+<div class="section">
+<h3><a id="now-the-real-heading" name="now-the-real-heading">Now the real heading</a></h3>
<p>The brown fox jumped over the lazy dog.</p>
-<div class="section" id="with-a-subheading">
-<h4><a name="with-a-subheading">With a subheading</a></h4>
+<div class="section">
+<h4><a id="with-a-subheading" name="with-a-subheading">With a subheading</a></h4>
<p>Some text, bla ble bli blo blu. Yes, i know this is <a class="reference" href="http://www.example.com">Stupid</a>.</p>
</div>
</div>
Modified: zope-archetypes/trunk/PortalTransforms/transforms/broken.py
===================================================================
--- zope-archetypes/trunk/PortalTransforms/transforms/broken.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/PortalTransforms/transforms/broken.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -21,7 +21,7 @@
# do the format
msg = "Calling convert on BROKEN transform %s (%s). Error: %s" % \
(self.id, self.module, self.error)
- log(msg, severity=WARNING, id='PortalTransforms')
+ log(msg, severity=WARNING)
print msg
data.setData('')
return data
Modified: zope-archetypes/trunk/PortalTransforms/transforms/rest.py
===================================================================
--- zope-archetypes/trunk/PortalTransforms/transforms/rest.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/PortalTransforms/transforms/rest.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -18,15 +18,21 @@
We want the 'raw' and 'include' directives to be disabled by
default:
- >>> data = transform.convert('.. raw:: html\n :file: <isonum.txt>', D())
- 2
- >>> '"raw" directive disabled.' in data.value
- True
+ >>> try:
+ ... transform.convert('.. raw:: html\n :file: <isonum.txt>', D())
+ ... except NotImplementedError:
+ ... print 'Good'
+ ... else:
+ ... print 'Failure'
+ Good
- >>> data = transform.convert('.. include:: <isonum.txt>', D())
- >>> '"include" directive disabled.' in data.value
- True
-
+ >>> try:
+ ... transform.convert('.. include:: <isonum.txt>', D())
+ ... except NotImplementedError:
+ ... print 'Good'
+ ... else:
+ ... print 'Failure'
+ Good
"""
__implements__ = itransform
Modified: zope-archetypes/trunk/PortalTransforms/transforms/safe_html.py
===================================================================
--- zope-archetypes/trunk/PortalTransforms/transforms/safe_html.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/PortalTransforms/transforms/safe_html.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -8,6 +8,7 @@
from Products.CMFDefault.utils import SimpleHTMLParser
from Products.CMFDefault.utils import VALID_TAGS
from Products.CMFDefault.utils import NASTY_TAGS
+from Products.PortalTransforms.utils import safeToInt
# tag mapping: tag -> short or long tag
VALID_TAGS = VALID_TAGS.copy()
@@ -17,8 +18,8 @@
VALID_TAGS['ins'] = 1
VALID_TAGS['del'] = 1
VALID_TAGS['q'] = 1
-VALID_TAGS['map']=1
-VALID_TAGS['area']=1
+VALID_TAGS['map'] = 1
+VALID_TAGS['area'] = 1
msg_pat = """
<div class="system-message">
@@ -90,7 +91,7 @@
self.result.append(' %s="%s"' % (k, v))
#UNUSED endTag = '</%s>' % tag
- if self.valid.get(tag):
+ if safeToInt(self.valid.get(tag)):
self.result.append('>')
else:
self.result.append(' />')
@@ -106,7 +107,7 @@
if self.nasty.has_key(tag):
self.suppress = False
if self.suppress: return
- if self.valid.get(tag):
+ if safeToInt(self.valid.get(tag)):
self.result.append('</%s>' % tag)
#remTag = '</%s>' % tag
Modified: zope-archetypes/trunk/PortalTransforms/utils.py
===================================================================
--- zope-archetypes/trunk/PortalTransforms/utils.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/PortalTransforms/utils.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -28,3 +28,12 @@
import os.path
_www = os.path.join(os.path.dirname(__file__), 'www')
skins_dir = None
+
+def safeToInt(value):
+ """Convert value to integer or just return 0 if we can't"""
+ try:
+ return int(value)
+ except ValueError:
+ return 0
+ except TypeError:
+ return 0
Modified: zope-archetypes/trunk/PortalTransforms/version.txt
===================================================================
--- zope-archetypes/trunk/PortalTransforms/version.txt 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/PortalTransforms/version.txt 2007-02-09 14:52:51 UTC (rev 667)
@@ -1 +1 @@
-1.4.1-final
\ No newline at end of file
+1.5.0-final
\ No newline at end of file
Modified: zope-archetypes/trunk/debian/changelog
===================================================================
--- zope-archetypes/trunk/debian/changelog 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/debian/changelog 2007-02-09 14:52:51 UTC (rev 667)
@@ -1,3 +1,9 @@
+zope-archetypes (1.4.2-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Fabio Tranchitella <kobold at debian.org> Fri, 9 Feb 2007 15:52:30 +0100
+
zope-archetypes (1.4.1-1) unstable; urgency=low
* New upstream release.
Modified: zope-archetypes/trunk/validation/HISTORY.txt
===================================================================
--- zope-archetypes/trunk/validation/HISTORY.txt 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/validation/HISTORY.txt 2007-02-09 14:52:51 UTC (rev 667)
@@ -1,3 +1,21 @@
+1.5.0-final - 2006-12-15
+========================
+
+ * note for release-managers: The version-bump to 1.5 was a bit early, but now
+ as we have it, i keep it and next release number in the cycle needed for
+ Archetypes 1.4.2 (used for Plone 2.5.2) of PortalTransforms is then the 1.5
+ final.
+ We dont need increasing of release numbers because of Plone 3.0,
+ Archetypes 1.5, ... if theres no change in the dependend product, like
+ this one.
+ [jensens]
+
+1.5.0-a1 - 2006-10-25
+=====================
+
+ * Removed an unused import which caused a deprecation warning.
+ [hannosch]
+
1.4.1-final - 2006-09-08
========================
@@ -5,7 +23,7 @@
=====
* Modify the email validator to allow capitals in the domain. This fixes
- http://dev.plone.org/archetypes/ticket/663
+ http://dev.plone.org/archetypes/ticket/663.
[wichert]
post 1.3.4-final02 - 2006-01-15
Modified: zope-archetypes/trunk/validation/validators/ExpressionValidator.py
===================================================================
--- zope-archetypes/trunk/validation/validators/ExpressionValidator.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/validation/validators/ExpressionValidator.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -24,7 +24,6 @@
from Products.validation.interfaces.IValidator import IValidator
from Products.PageTemplates.Expressions import getEngine
-import Products.PageTemplates.TALES as TALES
class ExpressionValidator:
""" Validator for TALES Expressions
Modified: zope-archetypes/trunk/validation/validators/RegexValidator.py
===================================================================
--- zope-archetypes/trunk/validation/validators/RegexValidator.py 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/validation/validators/RegexValidator.py 2007-02-09 14:52:51 UTC (rev 667)
@@ -57,6 +57,6 @@
for r in self.regex:
m = r.match(value)
if not m:
- return ("Validation failed(%(name)s): '%(value)s' %(errmsg)s' " %
+ return ("Validation failed(%(name)s): '%(value)s' %(errmsg)s" %
{ 'name' : self.name, 'value': value, 'errmsg' : self.errmsg})
return 1
Modified: zope-archetypes/trunk/validation/version.txt
===================================================================
--- zope-archetypes/trunk/validation/version.txt 2007-02-09 14:51:51 UTC (rev 666)
+++ zope-archetypes/trunk/validation/version.txt 2007-02-09 14:52:51 UTC (rev 667)
@@ -1 +1 @@
-1.4.1-final
\ No newline at end of file
+1.5.0-final
\ No newline at end of file
More information about the pkg-zope-commits
mailing list