[CMF-checkins] CVS: Products/CMFCore - TypesTool.py:1.86
Jens Vagelpohl
jens at dataflake.org
Fri Mar 25 07:55:21 EST 2005
Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv23458/CMFCore
Modified Files:
TypesTool.py
Log Message:
- CMFCore.TypesTool: Added backwards compatibility code to the fix for
collector issue 49 (http://collector.zope.org/CMF/49)
=== Products/CMFCore/TypesTool.py 1.85 => 1.86 ===
--- Products/CMFCore/TypesTool.py:1.85 Wed Mar 23 16:56:09 2005
+++ Products/CMFCore/TypesTool.py Fri Mar 25 07:54:50 2005
@@ -710,10 +710,32 @@
fti = None
if typeinfo_name:
info = self.listDefaultTypeInformation()
- for (name, ft) in info:
- if name == typeinfo_name:
- fti = ft
- break
+
+ # Nasty orkaround to stay backwards-compatible
+ # This workaround will disappear in CMF 1.7
+ if typeinfo_name.endswith(')'):
+ # This is a new-style name. Proceed normally.
+ for (name, ft) in info:
+ if name == typeinfo_name:
+ fti = ft
+ break
+ else:
+ # Attempt to work around the old way
+ # This attempt harbors the problem that the first match on
+ # meta_type will be used. There could potentially be more
+ # than one TypeInformation sharing the same meta_type.
+ warn('Please switch to the new format for typeinfo names '
+ '\"product_id: type_id (meta_type)\", the old '
+ 'spelling will disappear in CMF 1.7', DeprecationWarning)
+
+ ti_prod, ti_mt = [x.strip() for x in typeinfo_name.split(':')]
+
+ for name, ft in info:
+ if ( name.startswith(ti_prod) and
+ name.endswith('(%s)' % ti_mt) ):
+ fti = ft
+ break
+
if fti is None:
raise BadRequest('%s not found.' % typeinfo_name)
if not id:
More information about the CMF-checkins
mailing list