* Remove six for PY2 compatability since our dependencies are not, PY2
is legacy.
* Removed usages of utils from future/past libraries since they are
deprecated. This includes 'from __future__ ...' and 'from past...'
statements.
* Removed compatibility imports for PY2, switched from six imports to
standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
* chore(deps): bump bleach from 2.1.4 to 3.1.2
Bumps [bleach](https://github.com/mozilla/bleach) from 2.1.4 to 3.1.2.
- [Release notes](https://github.com/mozilla/bleach/releases)
- [Changelog](https://github.com/mozilla/bleach/blob/master/CHANGES)
- [Commits](https://github.com/mozilla/bleach/compare/v2.1.4...v3.1.2)
Signed-off-by: dependabot[bot] <support@github.com>
* chore: use html.parser instead of html5lib
bleach no longer ships html5lib as a requirement and instead has
included it in the system. we can switch to using html.parser instead;
which is not an external dependency unlike html5lib.
source: https://github.com/mozilla/bleach/blob/master/CHANGES#L206
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: use html5lib from bleach
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: import html5lib from bleach._vendor
fixes issue where bs4 is unable to find html5lib in the tree:
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: bleach._vendor.html5lib. Do you need to install a parser library?
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: just give up and install html5lib as a dependency
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chinmay D. Pai <chinmaydpai@gmail.com>
Same as other attributes, we could indicate default orientation by indicating in the .print-format css class without hardcoding, which is useful for cloud users.
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
If wkhtmltopdf throws a ContentNotFoundError exception (even though there is content) or other catchable exceptions the output keyword is not updated properly as it is in the try: section if no exception is thrown. This causes the PDF being returned to be empty, empty PdfFileWriter() created in print_format.py line 26. This causes issues like https://github.com/frappe/erpnext/issues/13124 to occur where the viewer.js throws an error due to a bad pdf file. The ContentNotFoundError exception is happening due to no header image in the letterhead or its a bad link being used when multi printing.
The whole get_pdf() function should be rebuilt to test for ContentNotFoundError and other errors from wkhtmltopdf and then use a secondary try/catch to check for any other IOErrors related to being able to read the PDF back in from the file. Right now this is not DRY since I basically copy and pasted lines 18 - 22 under line 31 so that if there is an error but the file exists the output will still be appended properly.
* [listview] Show freeze message
* Call refresh on same page
* Simplify query_report lifecycle, Print partially working
* PDF Print, frappe.render_pdf
* Show freeze message
* Export