Skip to content

Commit

Permalink
issue2551285 - Remove StructuredText support
Browse files Browse the repository at this point in the history
Asked on the users mailing list if anybody was using it. Got no responses.
I have never seen CI installing structuredtext packages so it's
untested as well.
  • Loading branch information
rouilj committed May 1, 2024
1 parent e264dc8 commit 23a9b5c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 48 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ Fixed:
- issue2551302 - Remove support for sqlite version 1 from
back_sqlite.py. We have been using sqlite3 for over a decade. (John
Rouillard)
- issue2551285 - Remove StructuredText support. reStructuredText is
still supported. (John Rouillard)

Features:

Expand Down
3 changes: 3 additions & 0 deletions doc/upgrading.txt
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,9 @@ Deprecation Notices (info)

Support for SQLite version 1 has been removed in 2.4.0.

Support for StructuredText has been removed in 2.4.0. Support for
reStructuredText remains.

Support for the `PySQLite <https://github.com/ghaering/pysqlite>`_
library will be removed in 2.5.0. Only the Python supplied sqlite3
library will be supported.
Expand Down
20 changes: 0 additions & 20 deletions roundup/cgi/templating.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@

from .KeywordsExpr import render_keywords_expression_editor

try:
from StructuredText.StructuredText import HTML as StructuredText
except ImportError:
try: # older version
import StructuredText
except ImportError:
StructuredText = None
try:
from docutils.core import publish_parts as ReStructuredText
except ImportError:
Expand Down Expand Up @@ -1866,19 +1859,6 @@ def wrapped(self, escape=1, hyperlink=1, columns=80):
s = self.hyper_re.sub(self._hyper_repl, s)
return s

def stext(self, escape=0, hyperlink=1):
""" Render the value of the property as StructuredText.
This requires the StructureText module to be installed separately.
"""
if not self.is_view_ok():
return self._('[hidden]')

s = self.plain(escape=escape, hyperlink=hyperlink)
if not StructuredText:
return s
return StructuredText(s, level=1, header=0)

def rst(self, hyperlink=1):
""" Render the value of the property as ReStructuredText.
Expand Down
28 changes: 0 additions & 28 deletions test/test_templating.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@
skip_rst = mark_class(pytest.mark.skip(
reason='ReStructuredText not available'))

if StructuredText:
skip_stext = lambda func, *args, **kwargs: func
else:
skip_stext = mark_class(pytest.mark.skip(
reason='StructuredText not available'))

import roundup.cgi.templating
if roundup.cgi.templating._import_mistune():
skip_mistune = lambda func, *args, **kwargs: func
Expand Down Expand Up @@ -570,11 +564,6 @@ def test_string_rst(self):
self.assertEqual(t.rst(), u2s(t_result))
self.assertEqual(u.rst(), u2s(u_result))

@skip_stext
def test_string_stext(self):
p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A string with cmeerw@example.com *embedded* \u00df'))
self.assertEqual(p.stext(), u2s(u'<p>A string with <a href="mailto:cmeerw@example.com">cmeerw@example.com</a> <em>embedded</em> \u00df</p>\n'))

def test_string_field(self):
p = StringHTMLProperty(self.client, 'test', '1', None, 'test', 'A string <b> with rouilj@example.com embedded &lt; html</b>')
self.assertEqual(p.field(), '<input name="test1@test" size="30" type="text" value="A string &lt;b&gt; with rouilj@example.com embedded &amp;lt; html&lt;/b&gt;">')
Expand Down Expand Up @@ -1103,23 +1092,6 @@ def test_string_rst(self):
p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A string with cmeerw@example.com *embedded* \u00df'))
self.assertEqual(p.rst(), u2s(u'A string with <a href="mailto:cmeerw@example.com">cmeerw@example.com</a> *embedded* \u00df'))

class NoStextTestCase(TemplatingTestCase) :
def setUp(self):
TemplatingTestCase.setUp(self)

from roundup.cgi import templating
self.__StructuredText = templating.StructuredText
templating.StructuredText = None

def tearDown(self):
from roundup.cgi import templating
templating.StructuredText = self.__StructuredText

def test_string_stext(self):
p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A string with cmeerw@example.com *embedded* \u00df'))
self.assertEqual(p.stext(), u2s(u'A string with <a href="mailto:cmeerw@example.com">cmeerw@example.com</a> *embedded* \u00df'))


class ZUtilsTestcase(TemplatingTestCase):

def test_Iterator(self):
Expand Down

0 comments on commit 23a9b5c

Please sign in to comment.