[Zope-Checkins] CVS: Zope/lib/python/DocumentTemplate - cDocumentTemplate.c:1.45 ustr.py:1.3
Toby Dickenson
tdickenson@geminidataloggers.com
Thu, 25 Apr 2002 08:45:11 -0400
Update of /cvs-repository/Zope/lib/python/DocumentTemplate
In directory cvs.zope.org:/tmp/cvs-serv7178
Modified Files:
cDocumentTemplate.c ustr.py
Log Message:
better docstrings, and added missing ZPL to ustr.py
=== Zope/lib/python/DocumentTemplate/cDocumentTemplate.c 1.44 => 1.45 ===
""},
{"join_unicode", (PyCFunction)join_unicode, METH_VARARGS,
- "join a list of plain strings into a single plain string,"
- "a list of unicode strings into a single unicode strings,"
- "or a list containing a mix into a single unicode string with"
+ "join a list of plain strings into a single plain string,\n"
+ "a list of unicode strings into a single unicode strings,\n"
+ "or a list containing a mix into a single unicode string with\n"
"the plain strings converted from latin-1"},
{"safe_callable", (PyCFunction)safe_callable, METH_VARARGS,
"callable() with a workaround for a problem with ExtensionClasses\n"
=== Zope/lib/python/DocumentTemplate/ustr.py 1.2 => 1.3 ===
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+#
+##############################################################################
+
from types import StringType, UnicodeType, InstanceType
nasty_exception_str = Exception.__str__.im_func
def ustr(v):
- """convert an object to a plain string or unicode string
+ """Convert any object to a plain string or unicode string,
+ minimising the chance of raising a UnicodeError. This
+ even works with uncooperative objects like Exceptions
"""
string_types = (StringType,UnicodeType)
if type(v) in string_types: