|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: htmltemplate.py,v 1.36 2001-10-28 22:51:38 richard Exp $ |
| 18 | +# $Id: htmltemplate.py,v 1.37 2001-10-31 06:24:35 richard Exp $ |
19 | 19 |
|
20 | 20 | import os, re, StringIO, urllib, cgi, errno |
21 | 21 |
|
22 | 22 | import hyperdb, date, password |
23 | 23 |
|
| 24 | +# This imports the StructureText functionality for the do_stext function |
| 25 | +# get it from http://dev.zope.org/Members/jim/StructuredTextWiki/NGReleases |
| 26 | +try: |
| 27 | + from StructuredText.StructuredText import HTML as StructuredText |
| 28 | +except ImportError: |
| 29 | + StructuredText = None |
| 30 | + |
| 31 | + |
24 | 32 | class TemplateFunctions: |
25 | 33 | def __init__(self): |
26 | 34 | self.form = None |
@@ -74,6 +82,15 @@ def do_plain(self, property, escape=0): |
74 | 82 | return cgi.escape(value) |
75 | 83 | return value |
76 | 84 |
|
| 85 | + def do_stext(self, property, escape=0): |
| 86 | + '''Render as structured text using the StructuredText module |
| 87 | + (see above for details) |
| 88 | + ''' |
| 89 | + s = self.do_plain(property, escape=escape) |
| 90 | + if not StructuredText: |
| 91 | + return s |
| 92 | + return StructuredText(s,level=1,header=0) |
| 93 | + |
77 | 94 | def do_field(self, property, size=None, height=None, showid=0): |
78 | 95 | ''' display a property like the plain displayer, but in a text field |
79 | 96 | to be edited |
@@ -827,6 +844,9 @@ def render(self, form): |
827 | 844 |
|
828 | 845 | # |
829 | 846 | # $Log: not supported by cvs2svn $ |
| 847 | +# Revision 1.36 2001/10/28 22:51:38 richard |
| 848 | +# Fixed ENOENT/WindowsError thing, thanks Juergen Hermann |
| 849 | +# |
830 | 850 | # Revision 1.35 2001/10/24 00:04:41 richard |
831 | 851 | # Removed the "infinite authentication loop", thanks Roch'e |
832 | 852 | # |
|
0 commit comments