From: richard Date: Mon, 13 Jan 2003 23:30:44 +0000 (+0000) Subject: fix StringHTMLProperty hyperlinking X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=39b435c4cd54dba7df2f98b9a5c6d67fd68ff71e;p=roundup.git fix StringHTMLProperty hyperlinking git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1450 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index 5474e7b..ab49ca5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -12,11 +12,13 @@ are given with the most recent entry first. - cleaning old unused sessions only once per hour, not on every cgi request. It is greatly improves web interface performance, especially on trackers under high load +- fix StringHTMLProperty hyperlinking 2003-??-?? 0.5.5 - fixed rdbms searching by ID (sf bug 666615) - detect corrupted index and raise semi-useful exception (sf bug 666767) - open server logfile unbuffered +- revert StringHTMLProperty to not hyperlink text by default 2003-01-10 0.5.4 diff --git a/doc/customizing.txt b/doc/customizing.txt index 122b872..886e37a 100644 --- a/doc/customizing.txt +++ b/doc/customizing.txt @@ -2,7 +2,7 @@ Customising Roundup =================== -:Version: $Revision: 1.70 $ +:Version: $Revision: 1.71 $ .. This document borrows from the ZopeBook section on ZPT. The original is at: http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx @@ -1247,32 +1247,58 @@ _value the value of the property if any - this is the actual value There are several methods available on these wrapper objects: -=========== ================================================================= -Method Description -=========== ================================================================= -plain render a "plain" representation of the property -field render an appropriate form edit field for the property - for most - types this is a text entry box, but for Booleans it's a tri-state - yes/no/neither selection. -stext only on String properties - render the value of the - property as StructuredText (requires the StructureText module - to be installed separately) -multiline only on String properties - render a multiline form edit - field for the property -email only on String properties - render the value of the - property as an obscured email address -confirm only on Password properties - render a second form edit field for - the property, used for confirmation that the user typed the - password correctly. Generates a field with name "name:confirm". -reldate only on Date properties - render the interval between the - date and now -pretty only on Interval properties - render the interval in a - pretty format (eg. "yesterday") -menu only on Link and Multilink properties - render a form select - list for this property -reverse only on Multilink properties - produce a list of the linked - items in reverse order -=========== ================================================================= +========= ===================================================================== +Method Description +========= ===================================================================== +plain render a "plain" representation of the property. This method may + take two arguments: + + escape + If true, escape the text so it is HTML safe (default: no). The + reason this defaults to off is that text is usually escaped + at a later stage by the TAL commands, unless the "structure" + option is used in the template. The following are all equivalent:: + +

+

+

+

+ + Usually you'll only want to use the escape option in a complex + expression. + + hyperlink + If true, turn URLs, email addresses and hyperdb item designators + in the text into hyperlinks (default: no). Note that you'll need + to use the "structure" TAL option if you want to use this:: + +

+ + Note also that the text is automatically HTML-escape before the + hyperlinking transformation. + +field render an appropriate form edit field for the property - for most + types this is a text entry box, but for Booleans it's a tri-state + yes/no/neither selection. +stext only on String properties - render the value of the + property as StructuredText (requires the StructureText module + to be installed separately) +multiline only on String properties - render a multiline form edit + field for the property +email only on String properties - render the value of the + property as an obscured email address +confirm only on Password properties - render a second form edit field for + the property, used for confirmation that the user typed the + password correctly. Generates a field with name "name:confirm". +reldate only on Date properties - render the interval between the + date and now +pretty only on Interval properties - render the interval in a + pretty format (eg. "yesterday") +menu only on Link and Multilink properties - render a form select + list for this property +reverse only on Multilink properties - produce a list of the linked + items in reverse order +========= ===================================================================== The request variable ~~~~~~~~~~~~~~~~~~~~ diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py index 7017701..bf2552e 100644 --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -786,7 +786,7 @@ class StringHTMLProperty(HTMLProperty): except KeyError: return '%s%s'%(s1, s2) - def plain(self, escape=0, hyperlink=1): + def plain(self, escape=0, hyperlink=0): ''' Render a "plain" representation of the property "escape" turns on/off HTML quoting @@ -798,8 +798,10 @@ class StringHTMLProperty(HTMLProperty): if escape: s = cgi.escape(str(self._value)) else: - s = self._value + s = str(self._value) if hyperlink: + if not escape: + s = cgi.escape(s) s = self.url_re.sub(self._url_repl, s) s = self.email_re.sub(self._email_repl, s) s = self.designator_re.sub(self._designator_repl, s) diff --git a/roundup/templates/classic/html/issue.item b/roundup/templates/classic/html/issue.item index abe2ce7..dcba3e0 100644 --- a/roundup/templates/classic/html/issue.item +++ b/roundup/templates/classic/html/issue.item @@ -140,7 +140,7 @@ python:db.user.classhelp('username,realname,address,phone')" />
-

content
+
content