[jToolkit-cvs] jToolkit/widgets widgets.py,1.3,1.4
Brought to you by:
davidfraser,
friedelwolff
From: <dav...@us...> - 2003-10-14 09:39:51
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1:/tmp/cvs-serv30644 Modified Files: widgets.py Log Message: added code to support joining unicode & str together in ContentWidget.getcontentshtml - a normal join doesn't support this, so if we detect the condition, we convert everything to unicode also added support for refreshing a page to a different URL Index: widgets.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/widgets.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** widgets.py 25 Sep 2003 17:36:55 -0000 1.3 --- widgets.py 14 Oct 2003 09:39:48 -0000 1.4 *************** *** 88,92 **** return contents elif type(contents) in (tuple, list): ! return "".join([self.getcontentshtml(contentspart) for contentspart in contents]) elif hasattr(contents, "gethtml"): return contents.gethtml() --- 88,99 ---- return contents elif type(contents) in (tuple, list): ! contentslist = [self.getcontentshtml(contentspart) for contentspart in contents] ! # TODO: investigate ways to neaten this up while still preventing ASCII decoding error... ! typelist = [type(p) for p in contentslist] ! if unicode in typelist and str in typelist: ! for n in range(len(contentslist)): ! if type(contentslist[n]) == str: ! contentslist[n] = contentslist[n].decode('iso8859') ! return "".join(contentslist) elif hasattr(contents, "gethtml"): return contents.gethtml() *************** *** 213,216 **** --- 220,224 ---- underlinelinks=self.attribs.get('underlinelinks',1) refresh=self.attribs.get('refresh',None) + refreshurl=self.attribs.get('refreshurl',None) result = """ <html> *************** *** 221,226 **** <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">""" if refresh is not None: ! result += """ ! <meta http-equiv="Refresh" content="%s">""" % (refresh) # stylesheet info result += """ --- 229,236 ---- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">""" if refresh is not None: ! if refreshurl is None: ! result += """<meta http-equiv="Refresh" content="%d">""" % (refresh) ! else: ! result += """<meta http-equiv="Refresh" content="%d; URL=%s">""" % (refresh, refreshurl) # stylesheet info result += """ |