Mercurial > p > roundup > code
diff roundup/htmltemplate.py @ 829:37ce3f2e05b2
added email display function
mangles email addrs so they're not so easily scraped from the web
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 09 Jul 2002 05:20:09 +0000 |
| parents | 6d7a45c8464a |
| children | 255bdcf39e8c |
line wrap: on
line diff
--- a/roundup/htmltemplate.py Tue Jul 09 04:34:39 2002 +0000 +++ b/roundup/htmltemplate.py Tue Jul 09 05:20:09 2002 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: htmltemplate.py,v 1.96 2002-07-09 04:19:09 richard Exp $ +# $Id: htmltemplate.py,v 1.97 2002-07-09 05:20:09 richard Exp $ __doc__ = """ Template engine. @@ -726,7 +726,7 @@ return _('<input type="submit" name="submit" value="Submit New Entry">') else: return _('[Submit: not called from item]') - + def do_classhelp(self, classname, properties, label='?', width='400', height='400'): '''pop up a javascript window with class help @@ -744,6 +744,35 @@ properties, width, height, label) #return '<a href="classhelp?classname=%s&properties=%s" target="classhelp"><b>(%s)</b></a>'%(classname, # properties, label) + + def do_email(self, property, escape=0): + '''display the property as one or more "fudged" email addrs + ''' + if not self.nodeid and self.form is None: + return _('[Email: not called from item]') + propclass = self.properties[property] + if self.nodeid: + # get the value for this property + try: + value = self.cl.get(self.nodeid, property) + except KeyError: + # a KeyError here means that the node doesn't have a value + # for the specified property + value = '' + else: + value = '' + if isinstance(propclass, hyperdb.String): + if value is None: value = '' + else: value = str(value) + value = value.replace('@', ' at ') + value = value.replace('.', ' ') + else: + value = _('[Email: not a string]')%locals() + if escape: + value = cgi.escape(value) + return value + + # # INDEX TEMPLATES # @@ -1237,6 +1266,11 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.96 2002/07/09 04:19:09 richard +# Added reindex command to roundup-admin. +# Fixed reindex on first access. +# Also fixed reindexing of entries that change. +# # Revision 1.95 2002/07/08 15:32:06 gmcm # Pagination of index pages. # New search form.
