summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0eb7cf0)
raw | patch | inline | side by side (parent: 0eb7cf0)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 9 Jul 2002 05:20:09 +0000 (05:20 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 9 Jul 2002 05:20:09 +0000 (05:20 +0000) |
scraped from the web
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@843 57a73879-2fb5-44c3-a270-3262357dd7e2
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@843 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/htmltemplate.py | patch | blob | history | |
test/test_htmltemplate.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index efb4ba5ccb6a0dbbb01d9695258f67a2a9863fc5..c8e4fdb33744f7bf282e7973699fb5ad78a6c51a 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
- new "reindex" command in roundup-admin used to force regeneration of the
index
. made the unit tests run again - they were quite b0rken
+ . added email display function - mangles email addrs so they're not so easily
+ scraped from the web
2002-06-24 0.4.2
index 65e9992c6d2e8f6fd3eb998285f573573ee3730b..a2bc439745fe31a9cd8cf5b72b4dd6e8107f2f95 100644 (file)
--- a/roundup/htmltemplate.py
+++ b/roundup/htmltemplate.py
# 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.
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
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
#
#
# $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.
index 4082be20f644a2fb45a1cc00aecb76775076d8e4..3342ab19985c021192bca22800b04df1e80e4298 100644 (file)
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test_htmltemplate.py,v 1.15 2002-07-08 06:39:00 richard Exp $
+# $Id: test_htmltemplate.py,v 1.16 2002-07-09 05:20:09 richard Exp $
import unittest, cgi, time
return '<html>hello, I am HTML</html>'
elif attribute == 'multiline':
return 'hello\nworld'
+ elif attribute == 'email':
+ return 'test@foo.domain.example'
def list(self):
return ['1', '2']
def filter(self, search_matches, filterspec, sort, group):
'link': Link('other'), 'multilink': Multilink('other'),
'password': Password(), 'html': String(), 'key': String(),
'novalue': String(), 'filename': String(), 'multiline': String(),
- 'reldate': Date()}
+ 'reldate': Date(), 'email': String()}
def labelprop(self, default_to_id=0):
return 'key'
@@ -349,12 +351,27 @@ the key2:<input type="checkbox" checked name="multilink" value="the key2">''')
'<a href="javascript:help_window(\'classhelp?classname=theclass'
'&properties=prop1,prop2\', \'400\', \'400\')"><b>(?)</b></a>')
+# def do_multiline(self, property, rows=5, cols=40)
+ def testEmail_string(self):
+ self.assertEqual(self.tf.do_email('email'), 'test at foo domain example')
+
+ def testEmail_nonstring(self):
+ s = _('[Email: not a string]')
+ self.assertEqual(self.tf.do_email('date'), s)
+ self.assertEqual(self.tf.do_email('interval'), s)
+ self.assertEqual(self.tf.do_email('password'), s)
+ self.assertEqual(self.tf.do_email('link'), s)
+ self.assertEqual(self.tf.do_email('multilink'), s)
+
def suite():
return unittest.makeSuite(NodeCase, 'test')
#
# $Log: not supported by cvs2svn $
+# Revision 1.15 2002/07/08 06:39:00 richard
+# Fixed unit test support class so the tests ran again.
+#
# Revision 1.14 2002/05/15 06:37:31 richard
# ehem and the unit test
#