Mercurial > p > roundup > code
comparison roundup/cgi/templating.py @ 1374:8e4c3e8de96f
fix StringHTMLProperty hyperlinking
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 13 Jan 2003 23:30:44 +0000 |
| parents | 52ef206a483b |
| children | d5314bfab0c0 |
comparison
equal
deleted
inserted
replaced
| 1373:229581bd1985 | 1374:8e4c3e8de96f |
|---|---|
| 784 self._db.getclass(s1) | 784 self._db.getclass(s1) |
| 785 return '<a href="%s">%s %s</a>'%(s, s1, s2) | 785 return '<a href="%s">%s %s</a>'%(s, s1, s2) |
| 786 except KeyError: | 786 except KeyError: |
| 787 return '%s%s'%(s1, s2) | 787 return '%s%s'%(s1, s2) |
| 788 | 788 |
| 789 def plain(self, escape=0, hyperlink=1): | 789 def plain(self, escape=0, hyperlink=0): |
| 790 ''' Render a "plain" representation of the property | 790 ''' Render a "plain" representation of the property |
| 791 | 791 |
| 792 "escape" turns on/off HTML quoting | 792 "escape" turns on/off HTML quoting |
| 793 "hyperlink" turns on/off in-text hyperlinking of URLs, email | 793 "hyperlink" turns on/off in-text hyperlinking of URLs, email |
| 794 addresses and designators | 794 addresses and designators |
| 796 if self._value is None: | 796 if self._value is None: |
| 797 return '' | 797 return '' |
| 798 if escape: | 798 if escape: |
| 799 s = cgi.escape(str(self._value)) | 799 s = cgi.escape(str(self._value)) |
| 800 else: | 800 else: |
| 801 s = self._value | 801 s = str(self._value) |
| 802 if hyperlink: | 802 if hyperlink: |
| 803 if not escape: | |
| 804 s = cgi.escape(s) | |
| 803 s = self.url_re.sub(self._url_repl, s) | 805 s = self.url_re.sub(self._url_repl, s) |
| 804 s = self.email_re.sub(self._email_repl, s) | 806 s = self.email_re.sub(self._email_repl, s) |
| 805 s = self.designator_re.sub(self._designator_repl, s) | 807 s = self.designator_re.sub(self._designator_repl, s) |
| 806 return s | 808 return s |
| 807 | 809 |
