r616 - in zope-atcontenttypes/branches/upstream/current: . content
criteria etc lib migration skins/ATContentTypes tests
Fabio Tranchitella
kobold at alioth.debian.org
Fri Feb 9 14:47:34 CET 2007
Author: kobold
Date: 2007-02-09 14:47:33 +0100 (Fri, 09 Feb 2007)
New Revision: 616
Added:
zope-atcontenttypes/branches/upstream/current/criteria/relativepath.py
Modified:
zope-atcontenttypes/branches/upstream/current/HISTORY.txt
zope-atcontenttypes/branches/upstream/current/__init__.py
zope-atcontenttypes/branches/upstream/current/content/base.py
zope-atcontenttypes/branches/upstream/current/content/event.py
zope-atcontenttypes/branches/upstream/current/content/topic.py
zope-atcontenttypes/branches/upstream/current/criteria/__init__.py
zope-atcontenttypes/branches/upstream/current/criteria/portaltype.py
zope-atcontenttypes/branches/upstream/current/etc/atcontenttypes.conf.in
zope-atcontenttypes/branches/upstream/current/implements.zcml
zope-atcontenttypes/branches/upstream/current/lib/validators.py
zope-atcontenttypes/branches/upstream/current/migration/__init__.py
zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_album_view.pt
zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_manageTopicIndex.cpt
zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_manageTopicMetadata.cpt
zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_topic_view.pt
zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/criterion_save.cpy
zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/getXMLSelectVocab.py
zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/validate_atct.vpy
zope-atcontenttypes/branches/upstream/current/tests/test_atevent.py
zope-atcontenttypes/branches/upstream/current/tests/test_atfile.py
zope-atcontenttypes/branches/upstream/current/tests/test_attopic.py
zope-atcontenttypes/branches/upstream/current/tests/test_constraintypes.py
zope-atcontenttypes/branches/upstream/current/tests/test_criteria.py
zope-atcontenttypes/branches/upstream/current/tests/test_skinScripts.py
zope-atcontenttypes/branches/upstream/current/version.txt
Log:
[svn-upgrade] Integrating new upstream version, zope-atcontenttypes (1.1.4)
Modified: zope-atcontenttypes/branches/upstream/current/HISTORY.txt
===================================================================
--- zope-atcontenttypes/branches/upstream/current/HISTORY.txt 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/HISTORY.txt 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/__init__.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/__init__.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/__init__.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -103,4 +103,3 @@
extra_constructors = (constructor,),
fti = ftis,
).initialize(context)
-
Modified: zope-atcontenttypes/branches/upstream/current/content/base.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/content/base.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/content/base.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/content/event.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/content/event.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/content/event.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -253,7 +253,7 @@
if type(value) is StringType:
v = (value, )
elif value:
- v = value[0]
+ v = value
else:
v = ()
Modified: zope-atcontenttypes/branches/upstream/current/content/topic.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/content/topic.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/content/topic.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/criteria/__init__.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/criteria/__init__.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/criteria/__init__.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/criteria/portaltype.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/criteria/portaltype.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/criteria/portaltype.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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')
Added: zope-atcontenttypes/branches/upstream/current/criteria/relativepath.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/criteria/relativepath.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/criteria/relativepath.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -0,0 +1,135 @@
+# ATContentTypes http://sf.net/projects/collective/
+# Archetypes reimplementation of the CMF core types
+# Copyright (c) 2003-2005 AT Content Types development team
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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
+#
+""" Topic:
+
+"""
+
+__author__ = 'Alec Mitchell, Danny Bloemendaal'
+__docformat__ = 'restructuredtext'
+# __old_name__ = 'Products.ATContentTypes.types.criteria.ATPathCriterion'
+
+from Products.CMFCore.permissions import View
+from AccessControl import ClassSecurityInfo
+
+from Products.Archetypes.public import Schema, DisplayList
+from Products.Archetypes.public import BooleanField, StringField
+from Products.Archetypes.public import BooleanWidget, SelectionWidget, StringWidget
+from Products.Archetypes.Referenceable import Referenceable
+
+from Products.ATContentTypes.criteria import registerCriterion
+from Products.ATContentTypes.criteria import PATH_INDICES
+from Products.ATContentTypes.interfaces import IATTopicSearchCriterion
+from Products.ATContentTypes.permission import ChangeTopics
+from Products.ATContentTypes.criteria.base import ATBaseCriterion
+from Products.ATContentTypes.criteria.schemata import ATBaseCriterionSchema
+
+from Products.CMFCore.utils import getToolByName
+
+ATRelativePathCriterionSchema = ATBaseCriterionSchema + Schema((
+ StringField('relativePath',
+ default='..',
+ widget=StringWidget(label='Relative path',
+ label_msgid="label_relativepath_criteria_customrelativepath",
+ description_msgid="help_relativepath_criteria_customrelativepath",
+ i18n_domain="plone",
+ description="Enter a relative path e.g.: <br /> '..' for the parent folder <br /> '../..' for the parent's parent <br />'../somefolder' for a sibling folder")),
+ BooleanField('recurse',
+ mode="rw",
+ write_permission=ChangeTopics,
+ accessor="Recurse",
+ default=False,
+ widget=BooleanWidget(
+ label="Search Sub-Folders",
+ label_msgid="label_path_criteria_recurse",
+ description="",
+ description_msgid="help_path_criteria_recurse",
+ i18n_domain="plone"),
+ ),
+ ))
+
+class ATRelativePathCriterion(ATBaseCriterion):
+ """A path criterion"""
+
+ __implements__ = ATBaseCriterion.__implements__ + (IATTopicSearchCriterion, )
+ security = ClassSecurityInfo()
+ schema = ATRelativePathCriterionSchema
+ meta_type = 'ATRelativePathCriterion'
+ archetype_name = 'Relative Path Criterion'
+ typeDescription= ''
+ typeDescMsgId = ''
+
+ shortDesc = 'Location in site relative to the current location'
+
+ def getNavTypes(self):
+ ptool = self.plone_utils
+ nav_types = ptool.typesToList()
+ return nav_types
+
+ security.declareProtected(View, 'getCriteriaItems')
+ def getCriteriaItems(self):
+ result = []
+ depth = (not self.Recurse() and 1) or -1
+ relPath = self.getRelativePath()
+
+ # sanitize a bit: you never know, with all those windoze users out there
+ relPath = relPath.replace("\\","/")
+
+ # get the path to the portal object
+ portalPath = list(getToolByName(self, 'portal_url').getPortalObject().getPhysicalPath())
+
+ if relPath[0]=='/':
+ # someone didn't enter a relative path.
+ # simply use that one, relative to the portal
+ path = '/'.join(portalPath) + relPath
+ elif relPath=='..' or relPath=='../':
+ # do a shortcut
+ path = '/'.join(self.aq_parent.aq_parent.getPhysicalPath())
+ else:
+ folders = relPath.split('/')
+
+ # set the path to the smartfolder's path
+ path = list(self.aq_parent.getPhysicalPath())
+
+ # now construct an aboslute path based on the relative custom path
+ # eat away from 'path' whenever we encounter a '..' in the relative path
+ # apend all other elements other than ..
+ for folder in folders:
+ if folder == '..':
+ # chop off one level from path
+ if path == portalPath:
+ # can't chop off more
+ # just return this path and leave the loop
+ break
+ else:
+ path = path[:-1]
+ elif folder == '.':
+ # don't really need this but for being complete
+ # strictly speaking some user may use a . aswell
+ pass # do nothing
+ else:
+ path.append(folder)
+ path = '/'.join(path)
+
+ if path is not '':
+ result.append((self.Field(), {'query': path, 'depth': depth}))
+
+ return tuple(result)
+
+
+registerCriterion(ATRelativePathCriterion, PATH_INDICES)
Modified: zope-atcontenttypes/branches/upstream/current/etc/atcontenttypes.conf.in
===================================================================
--- zope-atcontenttypes/branches/upstream/current/etc/atcontenttypes.conf.in 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/etc/atcontenttypes.conf.in 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/implements.zcml
===================================================================
--- zope-atcontenttypes/branches/upstream/current/implements.zcml 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/implements.zcml 2007-02-09 13:47:33 UTC (rev 616)
@@ -118,6 +118,12 @@
/>
<implements
+ class=".criteria.relativepath.ATRelativePathCriterion"
+ interface=".interface.IATTopicSearchCriterion"
+ />
+
+
+ <implements
class=".criteria.portaltype.ATPortalTypeCriterion"
interface=".interface.IATTopicSearchCriterion"
/>
Modified: zope-atcontenttypes/branches/upstream/current/lib/validators.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/lib/validators.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/lib/validators.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/migration/__init__.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/migration/__init__.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/migration/__init__.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/skins/ATContentTypes/atct_album_view.pt
===================================================================
--- zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_album_view.pt 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_album_view.pt 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/skins/ATContentTypes/atct_manageTopicIndex.cpt
===================================================================
--- zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_manageTopicIndex.cpt 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_manageTopicIndex.cpt 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/skins/ATContentTypes/atct_manageTopicMetadata.cpt
===================================================================
--- zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_manageTopicMetadata.cpt 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_manageTopicMetadata.cpt 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/skins/ATContentTypes/atct_topic_view.pt
===================================================================
--- zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_topic_view.pt 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/atct_topic_view.pt 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/skins/ATContentTypes/criterion_save.cpy
===================================================================
--- zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/criterion_save.cpy 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/criterion_save.cpy 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/skins/ATContentTypes/getXMLSelectVocab.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/getXMLSelectVocab.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/getXMLSelectVocab.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/skins/ATContentTypes/validate_atct.vpy
===================================================================
--- zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/validate_atct.vpy 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/skins/ATContentTypes/validate_atct.vpy 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/tests/test_atevent.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/tests/test_atevent.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/tests/test_atevent.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/tests/test_atfile.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/tests/test_atfile.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/tests/test_atfile.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/tests/test_attopic.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/tests/test_attopic.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/tests/test_attopic.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/tests/test_constraintypes.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/tests/test_constraintypes.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/tests/test_constraintypes.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/tests/test_criteria.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/tests/test_criteria.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/tests/test_criteria.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/tests/test_skinScripts.py
===================================================================
--- zope-atcontenttypes/branches/upstream/current/tests/test_skinScripts.py 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/tests/test_skinScripts.py 2007-02-09 13:47:33 UTC (rev 616)
@@ -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/branches/upstream/current/version.txt
===================================================================
--- zope-atcontenttypes/branches/upstream/current/version.txt 2007-02-09 13:04:50 UTC (rev 615)
+++ zope-atcontenttypes/branches/upstream/current/version.txt 2007-02-09 13:47:33 UTC (rev 616)
@@ -1 +1 @@
-1.1.3-final
+1.1.4-final
More information about the pkg-zope-commits
mailing list