[CMF-checkins] CVS: CMF/CMFDefault/skins/generic - css_inline_or_link.py:1.4

Yvo Schubbe cvs-admin at zope.org
Mon Dec 1 08:56:15 EST 2003


Update of /cvs-repository/CMF/CMFDefault/skins/generic
In directory cvs.zope.org:/tmp/cvs-serv16302/CMFDefault/skins/generic

Modified Files:
	css_inline_or_link.py 
Log Message:
some code modernization:
- death to string module
- death to apply
- import and whitespace cleanup


=== CMF/CMFDefault/skins/generic/css_inline_or_link.py 1.3 => 1.4 ===
--- CMF/CMFDefault/skins/generic/css_inline_or_link.py:1.3	Tue Jun 11 09:17:21 2002
+++ CMF/CMFDefault/skins/generic/css_inline_or_link.py	Mon Dec  1 08:55:44 2003
@@ -6,9 +6,10 @@
 ##bind script=script
 ##bind subpath=traverse_subpath
 ##title=Browser detection for stylesheet handling
-
-import string
-
+##
+from Products.CMFCore.utils import getToolByName
+utool = getToolByName(script, 'portal_url')
+portal_url = utool()
 stylesheet_code = ''
 
 if hasattr(context, 'stylesheet_properties'):
@@ -17,11 +18,11 @@
     sheet = context.stylesheet_properties.select_stylesheet_id
 
     if sheet:
-        if ag[:9] == 'Mozilla/4' and string.find(ag, 'MSIE') < 0:
+        if ag[:9] == 'Mozilla/4' and ag.find('MSIE') < 0:
             s_obj = getattr(context, sheet)
             s_content = s_obj(None, _, do_inline_css=1)
             stylesheet_code = '<style type="text/css">\n<!--\n %s\n -->\n</style>' % s_content
         else:
-            s_url = '%s/%s' % (context.portal_url(), sheet)
+            s_url = '%s/%s' % (portal_url, sheet)
             stylesheet_code = '<link rel="stylesheet" href="%s" type="text/css" />' % s_url
 return stylesheet_code




More information about the CMF-checkins mailing list