[Zope3-checkins] CVS: Zope3/src/zope/app/pagetemplate/tests - test_talesapi.py:1.5
Steve Alexander
steve@cat-box.net
Fri, 13 Jun 2003 13:41:50 -0400
Update of /cvs-repository/Zope3/src/zope/app/pagetemplate/tests
In directory cvs.zope.org:/tmp/cvs-serv28622/src/zope/app/pagetemplate/tests
Modified Files:
test_talesapi.py
Log Message:
Removed the @@object_name view, as used in some page templates, and
the ObjectName view and adapter also.
Extended IPhysicallyLocatable with a getName method.
Renamed the convenience function objectName to getName.
If you have page templates that use @@object_name, then you can replace it
with zope:name.
=== Zope3/src/zope/app/pagetemplate/tests/test_talesapi.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/pagetemplate/tests/test_talesapi.py:1.4 Sun Jun 1 11:59:34 2003
+++ Zope3/src/zope/app/pagetemplate/tests/test_talesapi.py Fri Jun 13 13:41:19 2003
@@ -20,13 +20,14 @@
from zope.interface import implements
from zope.app.interfaces.dublincore import IZopeDublinCore
from zope.app.interfaces.size import ISized
+from zope.app.interfaces.traversing import IPhysicallyLocatable
from datetime import datetime
from zope.app.pagetemplate.talesapi import ZopeTalesAPI
-from zope.app.context import ContextWrapper
class TestObject(object):
implements(IZopeDublinCore, # not really, but who's checking. ;)
+ IPhysicallyLocatable, # not really
ISized)
description = u"This object stores some number of apples"
@@ -40,7 +41,10 @@
def sizeForDisplay(self):
return u'5 apples'
-testObject = ContextWrapper(TestObject(), None, name='apples')
+ def getName(self):
+ return u'apples'
+
+testObject = TestObject()
def title():
"""
@@ -60,7 +64,7 @@
"""
>>> api = ZopeTalesAPI(testObject)
>>> api.name()
- 'apples'
+ u'apples'
"""
def title_or_name():
@@ -69,11 +73,10 @@
>>> api.title_or_name()
u'apple cart'
- >>> testObject = ContextWrapper(TestObject(), None, name='apples')
>>> testObject.title = u""
>>> api = ZopeTalesAPI(testObject)
>>> api.title_or_name()
- 'apples'
+ u'apples'
"""
def size():
@@ -82,14 +85,14 @@
>>> api.size()
u'5 apples'
"""
-
+
def modified():
"""
>>> api = ZopeTalesAPI(testObject)
>>> api.modified
datetime.datetime(2003, 1, 2, 3, 4, 5)
"""
-
+
def created():
"""
>>> api = ZopeTalesAPI(testObject)