r650 - in zope-atcontenttypes/trunk: . content criteria debian etc
lib migration skins/ATContentTypes tests
Fabio Tranchitella
kobold at alioth.debian.org
Fri Feb 9 15:35:07 CET 2007
Author: kobold
Date: 2007-02-09 15:35:07 +0100 (Fri, 09 Feb 2007)
New Revision: 650
Added:
zope-atcontenttypes/trunk/criteria/relativepath.py
Modified:
zope-atcontenttypes/trunk/HISTORY.txt
zope-atcontenttypes/trunk/__init__.py
zope-atcontenttypes/trunk/content/base.py
zope-atcontenttypes/trunk/content/event.py
zope-atcontenttypes/trunk/content/topic.py
zope-atcontenttypes/trunk/criteria/__init__.py
zope-atcontenttypes/trunk/criteria/portaltype.py
zope-atcontenttypes/trunk/debian/changelog
zope-atcontenttypes/trunk/etc/atcontenttypes.conf.in
zope-atcontenttypes/trunk/implements.zcml
zope-atcontenttypes/trunk/lib/validators.py
zope-atcontenttypes/trunk/migration/__init__.py
zope-atcontenttypes/trunk/skins/ATContentTypes/atct_album_view.pt
zope-atcontenttypes/trunk/skins/ATContentTypes/atct_manageTopicIndex.cpt
zope-atcontenttypes/trunk/skins/ATContentTypes/atct_manageTopicMetadata.cpt
zope-atcontenttypes/trunk/skins/ATContentTypes/atct_topic_view.pt
zope-atcontenttypes/trunk/skins/ATContentTypes/criterion_save.cpy
zope-atcontenttypes/trunk/skins/ATContentTypes/getXMLSelectVocab.py
zope-atcontenttypes/trunk/skins/ATContentTypes/validate_atct.vpy
zope-atcontenttypes/trunk/tests/test_atevent.py
zope-atcontenttypes/trunk/tests/test_atfile.py
zope-atcontenttypes/trunk/tests/test_attopic.py
zope-atcontenttypes/trunk/tests/test_constraintypes.py
zope-atcontenttypes/trunk/tests/test_criteria.py
zope-atcontenttypes/trunk/tests/test_skinScripts.py
zope-atcontenttypes/trunk/version.txt
Log:
New upstream release.
Modified: zope-atcontenttypes/trunk/HISTORY.txt
===================================================================
--- zope-atcontenttypes/trunk/HISTORY.txt 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/HISTORY.txt 2007-02-09 14:35:07 UTC (rev 650)
@@ -1,13 +1,47 @@
-1.1.3-final 2006-9-20
+1.1.4-final 2006-12-18
======================
+ * Reenabled editing the names and descriptions of the smart folder indices
+ and metadata.
+ [alecm]
+
+ * Setting a sort criterion should not prevent search criteria for the same
+ field from being set. Fixes http://dev.plone.org/plone/ticket/5435
+ [alecm]
+
+ * ATEvent.setSubject needs to set multiple EventTypes to avoid pruning
+ the subject list. Applied patch from rossp. Fixes
+ http://dev.plone.org/plone/ticket/5770
+ [alecm]
+
+ * Add alt attributes to Topic table view type icons. This closes
+ http://dev.plone.org/plone/ticket/5562
+ [alecm]
+
+ * Fixed validation of filenames uploaded from IE. This closes
+ http://dev.plone.org/plone/ticket/5889.
+ [alecm]
+
+ * Reenabled translation of AJAX-ified smart folder info. This closes
+ http://dev.plone.org/plone/ticket/5806.
+ [hannosch]
+
+ * Got rid of last remnants of zLOG. Grep is our friend!
+ [stefan]
+
+ * Added a relative path criterion for Smart Folders to allow search paths
+ like "../somefolder"
+ [ender, elvix]
+
+1.1.3-final 2006-09-20
+======================
+
* Disabled translation of AJAX-ified smart folder info to temporarily remedy
http://dev.plone.org/plone/ticket/5806
[jensens]
1.1.2-final 2006-09-11
======================
-
* Changed integration tests to test Unicode titles instead of plain ascii.
[hannosch]
Modified: zope-atcontenttypes/trunk/__init__.py
===================================================================
--- zope-atcontenttypes/trunk/__init__.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/__init__.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -103,4 +103,3 @@
extra_constructors = (constructor,),
fti = ftis,
).initialize(context)
-
Modified: zope-atcontenttypes/trunk/content/base.py
===================================================================
--- zope-atcontenttypes/trunk/content/base.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/content/base.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -23,6 +23,7 @@
__docformat__ = 'restructuredtext'
+import os
import posixpath
from copy import copy
import logging
@@ -514,6 +515,9 @@
f_name = field.getName()
upload = REQUEST.form.get('%s_file' % f_name, None)
filename = getattr(upload, 'filename', None)
+ if isinstance(filename, basestring):
+ filename = os.path.basename(filename)
+ filename = filename.split("\\")[-1]
clean_filename = self._cleanupFilename(filename)
used_id = (id and not self._isIDAutoGenerated(id)) and id or clean_filename
Modified: zope-atcontenttypes/trunk/content/event.py
===================================================================
--- zope-atcontenttypes/trunk/content/event.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/content/event.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -253,7 +253,7 @@
if type(value) is StringType:
v = (value, )
elif value:
- v = value[0]
+ v = value
else:
v = ()
Modified: zope-atcontenttypes/trunk/content/topic.py
===================================================================
--- zope-atcontenttypes/trunk/content/topic.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/content/topic.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -349,7 +349,8 @@
def listAvailableFields(self):
"""Return a list of available fields for new criteria.
"""
- current = [ crit.Field() for crit in self.listCriteria() ]
+ current = [ crit.Field() for crit in self.listCriteria()
+ if not IATTopicSortCriterion.isImplementedBy(crit)]
fields = self.listFields()
val = [ field
for field in fields
Modified: zope-atcontenttypes/trunk/criteria/__init__.py
===================================================================
--- zope-atcontenttypes/trunk/criteria/__init__.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/criteria/__init__.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -146,3 +146,4 @@
from Products.ATContentTypes.criteria.sort import ATSortCriterion
from Products.ATContentTypes.criteria.currentauthor import ATCurrentAuthorCriterion
from Products.ATContentTypes.criteria.path import ATPathCriterion
+from Products.ATContentTypes.criteria.relativepath import ATRelativePathCriterion
Modified: zope-atcontenttypes/trunk/criteria/portaltype.py
===================================================================
--- zope-atcontenttypes/trunk/criteria/portaltype.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/criteria/portaltype.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -56,7 +56,7 @@
shortDesc = 'Select content types'
- security.declareProtected(View, 'getCriteriaItems')
+ security.declareProtected(View, 'getCurrentValues')
def getCurrentValues(self):
"""Return enabled portal types"""
plone_tool = getToolByName(self, 'plone_utils')
Copied: zope-atcontenttypes/trunk/criteria/relativepath.py (from rev 617, zope-atcontenttypes/branches/upstream/current/criteria/relativepath.py)
Modified: zope-atcontenttypes/trunk/debian/changelog
===================================================================
--- zope-atcontenttypes/trunk/debian/changelog 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/debian/changelog 2007-02-09 14:35:07 UTC (rev 650)
@@ -1,3 +1,9 @@
+zope-atcontenttypes (1.1.4-1) UNRELEASED; urgency=low
+
+ * (NOT RELEASED YET) New upstream release
+
+ -- Fabio Tranchitella <kobold at debian.org> Fri, 9 Feb 2007 14:47:47 +0100
+
zope-atcontenttypes (1.1.3-1) unstable; urgency=low
* New upstream release.
Modified: zope-atcontenttypes/trunk/etc/atcontenttypes.conf.in
===================================================================
--- zope-atcontenttypes/trunk/etc/atcontenttypes.conf.in 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/etc/atcontenttypes.conf.in 2007-02-09 14:35:07 UTC (rev 650)
@@ -143,6 +143,7 @@
description The location of an item in the site (path)
enabled on
criterion ATPathCriterion
+ criterion ATRelativePathCriterion
</index>
<index>
name portal_type
Modified: zope-atcontenttypes/trunk/implements.zcml
===================================================================
--- zope-atcontenttypes/trunk/implements.zcml 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/implements.zcml 2007-02-09 14:35:07 UTC (rev 650)
@@ -118,6 +118,12 @@
/>
<implements
+ class=".criteria.relativepath.ATRelativePathCriterion"
+ interface=".interface.IATTopicSearchCriterion"
+ />
+
+
+ <implements
class=".criteria.portaltype.ATPortalTypeCriterion"
interface=".interface.IATTopicSearchCriterion"
/>
Modified: zope-atcontenttypes/trunk/lib/validators.py
===================================================================
--- zope-atcontenttypes/trunk/lib/validators.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/lib/validators.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -36,7 +36,9 @@
import re
import encodings
-import zLOG
+import logging
+logger = logging.getLogger('ATCT')
+
from ZPublisher.HTTPRequest import FileUpload
from TAL.HTMLTALParser import HTMLTALParser
@@ -328,7 +330,7 @@
try:
return unicode(value, html_encoding).encode(char_encoding)
except:
- zLOG.LOG('validators', zLOG.INFO, "Error correcting encoding from %s to %s" % (html_encoding, char_encoding))
+ logger.info("Error correcting encoding from %s to %s" % (html_encoding, char_encoding))
return value
def parseErrorData(data, removeWarnings=0):
Modified: zope-atcontenttypes/trunk/migration/__init__.py
===================================================================
--- zope-atcontenttypes/trunk/migration/__init__.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/migration/__init__.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -63,6 +63,9 @@
'1.0.5-final',
null)
atct.registerUpgradePath('1.0.5-final',
+ '1.0.6-final',
+ null)
+ atct.registerUpgradePath('1.0.6-final',
'1.1.0-alpha1',
null)
atct.registerUpgradePath('1.1.0-alpha1',
@@ -86,3 +89,6 @@
atct.registerUpgradePath('1.1.2-final',
'1.1.3-final',
null)
+ atct.registerUpgradePath('1.1.3-final',
+ '1.1.4-final',
+ null)
Modified: zope-atcontenttypes/trunk/skins/ATContentTypes/atct_album_view.pt
===================================================================
--- zope-atcontenttypes/trunk/skins/ATContentTypes/atct_album_view.pt 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/skins/ATContentTypes/atct_album_view.pt 2007-02-09 14:35:07 UTC (rev 650)
@@ -41,7 +41,8 @@
</div>
</tal:images>
- <tal:albums tal:condition="albums" tal:repeat="album albums">
+ <div class="photoAlbum" tal:condition="albums">
+ <tal:albums tal:repeat="album albums">
<div class="photoAlbumEntry photoAlbumFolder"
tal:define="image_brains_in_album python:album.atctListAlbum(subimages=1)['subimages'];
number_of_images python:len(image_brains_in_album);
@@ -61,6 +62,7 @@
</a>
</div>
</tal:albums>
+ </div>
<div class="visualClear"><!-- --></div>
Modified: zope-atcontenttypes/trunk/skins/ATContentTypes/atct_manageTopicIndex.cpt
===================================================================
--- zope-atcontenttypes/trunk/skins/ATContentTypes/atct_manageTopicIndex.cpt 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/skins/ATContentTypes/atct_manageTopicIndex.cpt 2007-02-09 14:35:07 UTC (rev 650)
@@ -134,30 +134,17 @@
checked python:test(indexObj.enabled, 'checked', None)"/>
</td>
<td>
- <span tal:content="indexObj/friendlyName"
- i18n:translate=""
- i18n:domain="plone" />
- <input type="hidden"
+ <input type="text"
value=""
name=""
id=""
+ size="10"
tal:attributes="name string:index.friendlyName:records;
id string:${indexObj/index}_friendlyName;
- value indexObj/friendlyName;" />
+ value indexObj/friendlyName;
+ tabindex tabindex/next;"/>
</td>
<td>
- <div tal:content="indexObj/description"
- i18n:translate=""
- i18n:domain="plone">
- index description
- </div>
- <input type="hidden"
- value=""
- name="index.description:records"
- id=""
- tal:attributes="id string:${indexObj/index}_description;
- value indexObj/description" />
- <br />
<span i18n:translate="label_allowed_criteria">
Allowed Criteria:
</span>
@@ -173,10 +160,19 @@
<option tal:repeat="criterion python:atct_tool.getCriteriaForIndex(indexObj.index, as_dict= True)"
tal:attributes="value criterion/name;
selected python:test(criterion['name'] in indexObj.criteria, 'selected', None);"
- tal:content="criterion/description"
- i18n:translate=""
- i18n:domain="plone"/>
+ tal:content="criterion/description"/>
</select>
+ <br />
+ <span i18n:translate="label_help_text">
+ Help Text:
+ </span>
+ <textarea cols="50" rows="2" type="text"
+ value=""
+ name="index.description:records"
+ id=""
+ tal:attributes="id string:${indexObj/index}_description;
+ tabindex tabindex/next;"
+ tal:content="indexObj/description"></textarea>
</td>
</tr>
Modified: zope-atcontenttypes/trunk/skins/ATContentTypes/atct_manageTopicMetadata.cpt
===================================================================
--- zope-atcontenttypes/trunk/skins/ATContentTypes/atct_manageTopicMetadata.cpt 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/skins/ATContentTypes/atct_manageTopicMetadata.cpt 2007-02-09 14:35:07 UTC (rev 650)
@@ -133,27 +133,23 @@
checked python:test(indexObj.enabled, 'checked', None)"/>
</td>
<td>
- <span tal:content="indexObj/friendlyName"
- i18n:translate=""
- i18n:domain="plone" />
- <input type="hidden"
+ <input type="text"
value=""
name=""
id=""
+ size="10"
tal:attributes="name string:metadata.friendlyName:records;
- value indexObj/friendlyName; "/>
+ value indexObj/friendlyName;
+ tabindex tabindex/next;"/>
</td>
<td>
- <div tal:content="indexObj/description"
- i18n:translate=""
- i18n:domain="plone">
- metadata description
- </div>
- <input type="hidden"
+ <textarea cols="30" rows="4" type="text"
value=""
name=""
+ id=""
tal:attributes="name string:metadata.description:records;
- value indexObj/description" />
+ tabindex tabindex/next;"
+ tal:content="indexObj/description"></textarea>
</td>
</tr>
Modified: zope-atcontenttypes/trunk/skins/ATContentTypes/atct_topic_view.pt
===================================================================
--- zope-atcontenttypes/trunk/skins/ATContentTypes/atct_topic_view.pt 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/skins/ATContentTypes/atct_topic_view.pt 2007-02-09 14:35:07 UTC (rev 650)
@@ -89,7 +89,8 @@
<img src="#"
height="16"
width="16"
- tal:attributes="src icon"/>
+ tal:attributes="src icon;
+ alt obj/Type|obj_type"/>
</a>
<a href="#" tal:condition="python: obj.portal_type not in ['Link', 'Image']"
Modified: zope-atcontenttypes/trunk/skins/ATContentTypes/criterion_save.cpy
===================================================================
--- zope-atcontenttypes/trunk/skins/ATContentTypes/criterion_save.cpy 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/skins/ATContentTypes/criterion_save.cpy 2007-02-09 14:35:07 UTC (rev 650)
@@ -29,7 +29,7 @@
mutator = field.getMutator(criterion)
mutator(rval)
-msg = context.translate('Changes saved.')
+msg = 'Changes saved.'
transaction_note(msg)
return state.set(portal_status_message=msg)
Modified: zope-atcontenttypes/trunk/skins/ATContentTypes/getXMLSelectVocab.py
===================================================================
--- zope-atcontenttypes/trunk/skins/ATContentTypes/getXMLSelectVocab.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/skins/ATContentTypes/getXMLSelectVocab.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -10,17 +10,17 @@
params = {param:value, 'display_list': True}
vocab = getattr(context, method)(**params)
+site_encoding = context.plone_utils.getSiteEncoding()
+trans = context.translate
RESPONSE = context.REQUEST.RESPONSE
-RESPONSE.setHeader('Content-Type', 'text/xml')
+RESPONSE.setHeader('Content-Type', 'text/xml;charset=%s' % site_encoding)
-# this is broken (for example: language german + field=review_state)
-##results = [(trans(vocab.getMsgId(item), default=vocab.getValue(item)), item)
-## for item in vocab]
+results = [(trans(vocab.getMsgId(item), default=vocab.getValue(item)), item)
+ for item in vocab]
-results = [(vocab.getValue(item), item) for item in vocab]
-item_strings = ['^'.join(a) for a in results]
-result_string = '|'.join(item_strings)
+item_strings = [u'^'.join(a) for a in results]
+result_string = u'|'.join(item_strings)
-return "<div>%s</div>" % result_string
\ No newline at end of file
+return "<div>%s</div>" % result_string.encode(site_encoding)
\ No newline at end of file
Modified: zope-atcontenttypes/trunk/skins/ATContentTypes/validate_atct.vpy
===================================================================
--- zope-atcontenttypes/trunk/skins/ATContentTypes/validate_atct.vpy 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/skins/ATContentTypes/validate_atct.vpy 2007-02-09 14:35:07 UTC (rev 650)
@@ -34,7 +34,7 @@
if errors:
return state.set(status='failure', errors=errors, portal_status_message='Please correct the indicated errors.')
-message = context.translate('Changes saved.')
+message = 'Changes saved.'
#TODO: This should be an additional status message, which should be possible
#in Plone 2.5. Reactivate then but right now it's not possible to i18n-ize this.
#tidiedFields = request.get('tidiedFields', None)
Modified: zope-atcontenttypes/trunk/tests/test_atevent.py
===================================================================
--- zope-atcontenttypes/trunk/tests/test_atevent.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/tests/test_atevent.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -269,6 +269,13 @@
editATCT(atct)
self.failUnlessEqual(atct.get_size(), len(TEXT))
+ def test_set_subject_sets_eventtype(self):
+ atct = self._ATCT
+ atct.setSubject(['a','b','c'])
+ self.failUnless('a' in atct.getEventType())
+ self.failUnless('b' in atct.getEventType())
+ self.failUnless('c' in atct.getEventType())
+
tests.append(TestSiteATEvent)
class TestATEventFields(atcttestcase.ATCTFieldTestCase):
Modified: zope-atcontenttypes/trunk/tests/test_atfile.py
===================================================================
--- zope-atcontenttypes/trunk/tests/test_atfile.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/tests/test_atfile.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -192,6 +192,34 @@
self.failIf(id in self.folder.objectIds())
self.failUnless('Zope-Plo-ne .txt' in self.folder.objectIds())
+ def testWindowsUploadFilename(self):
+ class fakefile(StringIO.StringIO):
+ pass
+ fakefile = fakefile()
+ fakefile.filename = 'c:\\Windows\\Is\\Worthless\\file.txt'
+ id = 'file.2005-11-18.4066860574'
+ self.folder.invokeFactory(self.portal_type, id)
+ self.folder[id].setFile(fakefile)
+ self.failIf(id in self.folder.objectIds())
+ self.failIf(fakefile.filename in self.folder.objectIds())
+ self.failUnless('file.txt' in self.folder.objectIds())
+
+ def testWindowsDuplicateFiles(self):
+ class fakefile(StringIO.StringIO):
+ pass
+ fakefile = fakefile()
+ fakefile.filename = 'c:\\Windows\\Is\\Worthless\\file.txt'
+ id = 'file.2005-11-18.4066860574'
+ self.folder.invokeFactory(self.portal_type, id)
+ self.folder[id].setFile(fakefile)
+ self.folder.invokeFactory(self.portal_type, id)
+ request = self.folder.REQUEST
+ request.form['id'] = id
+ request.form['file_file'] = fakefile
+ errors = {}
+ self.folder[id].post_validate(request, errors)
+ self.failUnless(errors.has_key('file'))
+
tests.append(TestSiteATFile)
class TestATFileFields(atcttestcase.ATCTFieldTestCase):
Modified: zope-atcontenttypes/trunk/tests/test_attopic.py
===================================================================
--- zope-atcontenttypes/trunk/tests/test_attopic.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/tests/test_attopic.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -417,6 +417,21 @@
def test_schema_marshall(self):
pass
+ def test_sort_criterion_does_not_affect_available_fields(self):
+ topic = self._ATCT
+ # set a sort criterion
+ topic.setSortCriterion('created', False)
+ print topic.listAvailableFields()
+ # It should still be available for other criteria
+ self.failUnless([i for i in topic.listAvailableFields()
+ if i[0] == 'created'])
+ # Add a normal criteria for the same field
+ crit = topic.addCriterion('created', 'ATFriendlyDateCriteria')
+ # It should no longer be available
+ self.failIf([i for i in topic.listAvailableFields()
+ if i[0] == 'created'])
+
+
tests.append(TestSiteATTopic)
class TestATTopicFields(atcttestcase.ATCTFieldTestCase):
Modified: zope-atcontenttypes/trunk/tests/test_constraintypes.py
===================================================================
--- zope-atcontenttypes/trunk/tests/test_constraintypes.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/tests/test_constraintypes.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -147,15 +147,15 @@
# Let folder use a restricted set of types
self.portal.portal_types.Folder.filter_content_types = 1
self.portal.portal_types.Folder.allowed_content_types = \
- ('Document', 'Image', 'News Item', 'Topic', 'SimpleFolder', 'Folder')
+ ('Document', 'Image', 'News Item', 'Topic', 'CMF Folder', 'Folder')
# Set up outer folder with restrictions enabled
self.af.setConstrainTypesMode(constraintypes.ENABLED)
- self.af.setLocallyAllowedTypes(['Folder', 'Image', 'SimpleFolder'])
+ self.af.setLocallyAllowedTypes(['Folder', 'Image', 'CMF Folder'])
self.af.setImmediatelyAddableTypes(['Folder'])
# Create inner type to acquire (default)
- self.af.invokeFactory('SimpleFolder', 'outer', title='outer')
+ self.af.invokeFactory('CMF Folder', 'outer', title='outer')
outer = self.af.outer
outer.invokeFactory('Folder', 'inner', title='inner')
@@ -174,8 +174,8 @@
# Fail - we didn't acquire this, really, since we can't acquire
# from parent folder of different type
- self.assertRaises((Unauthorized, ValueError), inner.invokeFactory, 'CMF Folder', 'a')
- self.failIf('CMF Folder' in inner.getLocallyAllowedTypes())
+ self.assertRaises((Unauthorized, ValueError), inner.invokeFactory, 'Topic', 'a')
+ self.failIf('Topic' in inner.getLocallyAllowedTypes())
try:
# Will be OK, since we've got global defaults since we can't
# acquire from parent with different type
Modified: zope-atcontenttypes/trunk/tests/test_criteria.py
===================================================================
--- zope-atcontenttypes/trunk/tests/test_criteria.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/tests/test_criteria.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -55,6 +55,7 @@
from Products.ATContentTypes.criteria.currentauthor import \
ATCurrentAuthorCriterion
from Products.ATContentTypes.criteria.path import ATPathCriterion
+from Products.ATContentTypes.criteria.relativepath import ATRelativePathCriterion
tests = []
# z3 imports
@@ -585,6 +586,62 @@
tests.append(TestATCurrentAuthorCriterion)
+class TestATRelativePathCriterion(CriteriaTest):
+ klass = ATRelativePathCriterion
+ title = 'Relative Path Criterion'
+ meta_type = 'ATRelativePathCriterion'
+ portal_type = 'ATRelativePathCriterion'
+
+ def afterSetUp(self):
+ CriteriaTest.afterSetUp(self)
+ self.setRoles(['Manager'])
+ # build folder structure
+ self.portal.invokeFactory('Folder', 'folderA')
+ self.portal.invokeFactory('Folder', 'folderB')
+ self.portal.folderA.invokeFactory('Folder', 'folderA1')
+ self.portal.folderB.invokeFactory('Folder', 'folderB1')
+
+ # create topic in folderA1
+ self.portal.folderA.folderA1.invokeFactory('Topic', 'new_topic', title='New Topic')
+
+ self.topic = self.portal.folderA.folderA1.new_topic
+ # Add a path criterion
+ self.path_crit = self.topic.addCriterion('path', 'ATRelativePathCriterion')
+
+ def test_relative_path_query1(self):
+ self.path_crit.setRelativePath('..') # should give the parent==folderA1
+ self.failUnless(self.path_crit.getCriteriaItems() == (('path', {'query': '/plone/folderA/folderA1', 'depth': 1}),))
+
+ def test_relative_path_query2(self):
+ self.path_crit.setRelativePath('../..') # should give folderA
+ self.failUnless(self.path_crit.getCriteriaItems() == (('path', {'query': '/plone/folderA', 'depth': 1}),))
+
+ def test_relative_path_query3(self):
+ self.path_crit.setRelativePath('../../..') # should give the /plone (portal)
+ self.failUnless(self.path_crit.getCriteriaItems() == (('path', {'query': '/plone', 'depth': 1}),))
+
+ def test_relative_path_query4(self):
+ self.path_crit.setRelativePath('../../../../../../..') # should give the /plone (portal): cannot go higher than the portal
+ self.failUnless(self.path_crit.getCriteriaItems() == (('path', {'query': '/plone', 'depth': 1}),))
+
+ def test_relative_path_query5(self):
+ self.path_crit.setRelativePath('../../../folderB') # should give folderB
+ self.failUnless(self.path_crit.getCriteriaItems() == (('path', {'query': '/plone/folderB', 'depth': 1}),))
+
+ def test_relative_path_query6(self):
+ self.path_crit.setRelativePath('/folderB') # should give folderB also (absolute paths are supported)
+ self.failUnless(self.path_crit.getCriteriaItems() == (('path', {'query': '/plone/folderB', 'depth': 1}),))
+
+ def test_relative_path_query7(self):
+ self.path_crit.setRelativePath('../../folderA1/../../folderB/folderB1/..') # should give folderB
+ self.failUnless(self.path_crit.getCriteriaItems() == (('path', {'query': '/plone/folderB', 'depth': 1}),))
+
+ def test_relative_path_query8(self):
+ self.path_crit.setRelativePath('.') # should give the new_topic
+ self.failUnless(self.path_crit.getCriteriaItems() == (('path', {'query': '/plone/folderA/folderA1/new_topic', 'depth': 1}),))
+
+tests.append(TestATRelativePathCriterion)
+
class TestATPathCriterion(CriteriaTest):
klass = ATPathCriterion
title = 'Path Criterion'
Modified: zope-atcontenttypes/trunk/tests/test_skinScripts.py
===================================================================
--- zope-atcontenttypes/trunk/tests/test_skinScripts.py 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/tests/test_skinScripts.py 2007-02-09 14:35:07 UTC (rev 650)
@@ -41,12 +41,14 @@
self.script = self.portal.formatCatalogMetadata
def testFormatDate(self):
+ date = '2005-11-02 13:52:25'
+ format = '%m-%d-%Y %I:%M %p'
self.portal.portal_properties.site_properties.manage_changeProperties(
localLongTimeFormat='%m-%d-%Y %I:%M %p')
- self.assertEqual(self.script('2005-11-02 13:52:25'),
- '11-02-2005 01:52 PM')
- self.assertEqual(self.script(DateTime('2005-11-02 13:52:25')),
- '11-02-2005 01:52 PM')
+ self.assertEqual(self.script(date),
+ DateTime(date).strftime(format))
+ self.assertEqual(self.script(DateTime(date)),
+ DateTime(date).strftime(format))
def testFormatDict(self):
self.assertEqual(self.script({'a':1,'b':2}), 'a: 1, b: 2')
Modified: zope-atcontenttypes/trunk/version.txt
===================================================================
--- zope-atcontenttypes/trunk/version.txt 2007-02-09 14:10:25 UTC (rev 649)
+++ zope-atcontenttypes/trunk/version.txt 2007-02-09 14:35:07 UTC (rev 650)
@@ -1 +1 @@
-1.1.3-final
+1.1.4-final
More information about the pkg-zope-commits
mailing list