From: richard Date: Wed, 31 Oct 2001 06:24:35 +0000 (+0000) Subject: Added do_stext to htmltemplate, thanks Brad Clements. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=618857de4dd80fb4bb6c084499634b825461232e;p=roundup.git Added do_stext to htmltemplate, thanks Brad Clements. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@351 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/htmltemplate.py b/roundup/htmltemplate.py index 6f77a9e..46a2111 100644 --- a/roundup/htmltemplate.py +++ b/roundup/htmltemplate.py @@ -15,12 +15,20 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: htmltemplate.py,v 1.36 2001-10-28 22:51:38 richard Exp $ +# $Id: htmltemplate.py,v 1.37 2001-10-31 06:24:35 richard Exp $ import os, re, StringIO, urllib, cgi, errno import hyperdb, date, password +# This imports the StructureText functionality for the do_stext function +# get it from http://dev.zope.org/Members/jim/StructuredTextWiki/NGReleases +try: + from StructuredText.StructuredText import HTML as StructuredText +except ImportError: + StructuredText = None + + class TemplateFunctions: def __init__(self): self.form = None @@ -74,6 +82,15 @@ class TemplateFunctions: return cgi.escape(value) return value + def do_stext(self, property, escape=0): + '''Render as structured text using the StructuredText module + (see above for details) + ''' + s = self.do_plain(property, escape=escape) + if not StructuredText: + return s + return StructuredText(s,level=1,header=0) + def do_field(self, property, size=None, height=None, showid=0): ''' display a property like the plain displayer, but in a text field to be edited @@ -827,6 +844,9 @@ class NewItemTemplate(TemplateFunctions): # # $Log: not supported by cvs2svn $ +# Revision 1.36 2001/10/28 22:51:38 richard +# Fixed ENOENT/WindowsError thing, thanks Juergen Hermann +# # Revision 1.35 2001/10/24 00:04:41 richard # Removed the "infinite authentication loop", thanks Roch'e #