Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace MarkupPy by ElementTree for html conversion #554

Merged
merged 1 commit into from
Jul 2, 2023

Conversation

claudep
Copy link
Contributor

@claudep claudep commented Jul 1, 2023

No description provided.

@codecov
Copy link

codecov bot commented Jul 1, 2023

Codecov Report

Merging #554 (ee7a88d) into master (d48407c) will decrease coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #554      +/-   ##
==========================================
- Coverage   91.42%   91.37%   -0.06%     
==========================================
  Files          28       28              
  Lines        2730     2713      -17     
==========================================
- Hits         2496     2479      -17     
  Misses        234      234              
Impacted Files Coverage Δ
src/tablib/formats/__init__.py 95.45% <100.00%> (-0.06%) ⬇️
src/tablib/formats/_html.py 100.00% <100.00%> (ø)
tests/test_tablib.py 98.72% <100.00%> (-0.03%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mgorny
Copy link

mgorny commented Jul 2, 2023

Thanks. That's definitely better idea than mine (of skipping HTML tests). I also like that you're using DOM to create elements, that's probably the most efficient way of doing it.

@hugovk hugovk merged commit f3ef2e9 into jazzband:master Jul 2, 2023
21 checks passed
@hugovk
Copy link
Member

hugovk commented Jul 2, 2023

Thanks!

@claudep claudep deleted the markup branch July 2, 2023 17:47
@claudep
Copy link
Contributor Author

claudep commented Jul 2, 2023

Thanks for the merge.

While I was on this format, I explored a bit about adding html import support, also without external dependency: #555

@matthewhegarty
Copy link
Contributor

matthewhegarty commented Jul 19, 2023

I noticed that this change breaks the CI build in django-import-export. This is for cases when we are escaping harmful characters such as script tags.

If there is already an escaped character in content, then the use of ElementTree will double escape, which will not format correctly. This test will reproduce the issue:

    def test_html_export_with_special_chars(self):
        self.founders = tablib.Dataset(headers=self.headers, title='Founders')
        self.founders.append(('J &amp; J', 'A', 90))
        self.assertIn("J &amp; J", self.founders.html)

This test fails because the '&' string is exported as '&amp;' So if someone has 'J & J' in their content (rendered with an escape), they will now get 'J &amp; J'.

@claudep
Copy link
Contributor Author

claudep commented Jul 23, 2023

@matthewhegarty Please create a new issue for this problem where we can discuss that double-escaping issue.

archlinux-github pushed a commit to archlinux/aur that referenced this pull request Mar 23, 2024
Noteworthy change in regards of packaging: Upstream replaced the usage of python-markuppy with ElementTree
jazzband/tablib#554
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants