[Zope] RE: ZopeTime() and string.split/string.join
Chris McDonough
chris@iqgroup.com
Mon, 20 Sep 1999 21:14:06 -0400
Nevermind.
Sorry...
The answer is to replace
<dtml-let tmp_time="ZopeTime()">
with
<dtml-let tmp_time="_.str(ZopeTime())">
This changes the object value into a string.
Ugh.
-----Original Message-----
From: Chris McDonough
Sent: Monday, September 20, 1999 9:06 PM
To: 'zope@zope.org'
Subject: ZopeTime() and string.split/string.join
When I call this DTML method (in a container titled "News Items"):
<!--#var standard_html_header-->
<dtml-let tmp_time="title">
<dtml-var "_.string.join(_.string.split(tmp_time,' '),'_')">
</dtml-let>
<!--#var standard_html_footer-->
I am returned the header, a line that says "News_Items", and the footer.
However, when I call this DTML method:
<!--#var standard_html_header-->
<dtml-let tmp_time="ZopeTime()">
<dtml-var "_.string.join(_.string.split(tmp_time,' '),'_')">
</dtml-let>
<!--#var standard_html_footer-->
I get the following traceback:
Error Type: TypeError
Error Value: argument 1: expected read-only character buffer, instance found
Traceback (innermost last):
File /usr/local/Zope-2.0.0/lib/python/ZPublisher/Publish.py, line 214, in
publish_module
File /usr/local/Zope-2.0.0/lib/python/ZPublisher/Publish.py, line 179, in
publish
File /usr/local/Zope-2.0.0/lib/python/Zope/__init__.py, line 201, in
zpublisher_exception_hook
(Object: ElementWithAttributes)
File /usr/local/Zope-2.0.0/lib/python/ZPublisher/Publish.py, line 165, in
publish
File /usr/local/Zope-2.0.0/lib/python/ZPublisher/mapply.py, line 160, in
mapply
(Object: test)
File /usr/local/Zope-2.0.0/lib/python/ZPublisher/Publish.py, line 102, in
call_object
(Object: test)
File /usr/local/Zope-2.0.0/lib/python/OFS/DTMLMethod.py, line 145, in
__call__
(Object: test)
File /downloads/Zope-2.0.0-src/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
(Object: test)
File /downloads/Zope-2.0.0-src/lib/python/DocumentTemplate/DT_Let.py, line
145, in render
(Object: tmp_time="ZopeTime()")
File /downloads/Zope-2.0.0-src/lib/python/DocumentTemplate/DT_Util.py,
line 321, in eval
(Object: _.string.join(_.string.split(tmp_time,' '),'_'))
File <string>, line 0, in ?
TypeError: (see above)
Why is this?