From e4aadf6407864240f125b975f0d4b83030130e74 Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk <47930925+olksndrdevhub@users.noreply.github.com> Date: Fri, 29 Jan 2021 20:31:49 +0200 Subject: [PATCH 01/13] Add support for Django >=3.0 --- easy_pdf/rendering.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/easy_pdf/rendering.py b/easy_pdf/rendering.py index 53aa3f0..ee68ffa 100644 --- a/easy_pdf/rendering.py +++ b/easy_pdf/rendering.py @@ -9,8 +9,12 @@ from django.template import loader from django.http import HttpResponse from django.utils.http import urlquote -from django.utils.six import BytesIO +try: + from django.utils.six import BytesIO +except ImportError: + from six import BytesIO + import xhtml2pdf.default from xhtml2pdf import pisa From eebda16e796afe7230d7401abb3171cc32712e6b Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk <47930925+olksndrdevhub@users.noreply.github.com> Date: Fri, 29 Jan 2021 20:37:05 +0200 Subject: [PATCH 02/13] add six for Django>=3.0 support --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f1f283e..d3d004f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ django>=1.10 xhtml2pdf>=0.2b1 - +six>=1.15.0 # Dependencies of xhtml2pdf html5lib>=1.0b10 httplib2>=0.8 From 60c588e2b30078ca1cfb53fb170e9a7901a3c4ed Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk <47930925+olksndrdevhub@users.noreply.github.com> Date: Fri, 29 Jan 2021 20:41:23 +0200 Subject: [PATCH 03/13] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 221a4ce..95c30e9 100644 --- a/README.rst +++ b/README.rst @@ -20,7 +20,7 @@ Developed at `en.ig.ma software shop `_. Development Version ------------------- - +Note: This fork support Django>=3.0 with "xhtml2pdf" as rendering backend! Support with WeasyPrint is not tested! Note: A new PDF rendering backend using WeasyPrint for more accurate rendering is in development under the develop branch. See https://github.com/nigma/django-easy-pdf/pull/34 for changes, testing and discussion. From ab2d9e67f00f86ae4135fb2f41740a64091c4727 Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk Date: Sun, 31 Jan 2021 18:28:52 +0200 Subject: [PATCH 04/13] configure for uploud to TestPyPI --- AUTHORS.rst | 6 ++++++ HISTORY.rst | 5 +++++ requirements.txt | 2 +- setup.py | 17 +++++++++++------ tox.ini | 7 ++++--- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 9860f9e..a28aae8 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -13,3 +13,9 @@ Contributors * Jon Bolt (@epicbagel) * @msaizar * @SaeX + + +Maintainer +---------- + +* olksndrdevhub \ No newline at end of file diff --git a/HISTORY.rst b/HISTORY.rst index 1abdd17..09c64a5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,11 @@ History ------- +0.1.2 (2017-04-19) +++++++++++++++++++ + +* Update for Django >= 2.0 <= 3.1 + 0.1.1 (2017-04-19) ++++++++++++++++++ diff --git a/requirements.txt b/requirements.txt index d3d004f..b18a785 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -django>=1.10 +django>=2.0 xhtml2pdf>=0.2b1 six>=1.15.0 # Dependencies of xhtml2pdf diff --git a/setup.py b/setup.py index 48c6c46..4204e5f 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,9 @@ except ImportError: from distutils.core import setup -version = "0.1.2.dev1" +import setuptools + +version = "0.1.2-beta.1" if sys.argv[-1] == "publish": os.system("python setup.py sdist bdist_wheel upload") @@ -21,26 +23,28 @@ readme = open("README.rst").read() history = open("HISTORY.rst").read().replace(".. :changelog:", "") -setup( - name="django-easy-pdf", +setuptools.setup( + name="django-easy-pdf3-oleksandrdevhub", version=version, description="""Django PDF views, the easy way""", license="MIT", author="Filip Wasilewski", author_email="en@ig.ma", - url="https://github.com/nigma/django-easy-pdf", + maintainer='Romaniuk Oleksandr', + maintainer_email='oleksandr.romaniuk@protonmail.com', + url="https://github.com/olksndrdevhub/django-easy-pdf3", long_description=readme + "\n\n" + history, packages=[ "easy_pdf", ], include_package_data=True, install_requires=[ - "django>=1.8", + "django>=2.0", "xhtml2pdf>=0.2b1", "reportlab>=3" ], zip_safe=False, - keywords="django-easy-pdf", + keywords="django-easy-pdf3", classifiers=[ "Development Status :: 4 - Beta", "Environment :: Web Environment", @@ -55,6 +59,7 @@ "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.8", "Topic :: Software Development :: Libraries :: Python Modules" ], ) diff --git a/tox.ini b/tox.ini index 22e88c4..02df1c0 100644 --- a/tox.ini +++ b/tox.ini @@ -9,6 +9,7 @@ basepython = py3.4: python3.4 py3.5: python3.5 py3.6: python3.6 + py3.8: python3.8 commands = {envpython} -c "from django import VERSION; print('%s %s' % ('Django Version', VERSION))" {envpython} runtests.py @@ -16,12 +17,12 @@ deps = xhtml2pdf>=0.2b1 django-nose coverage - dj1.10: django>=1.10,<1.11 - dj1.11: django>=1.11,<1.12 + dj2.0: django>=2.0,<3.0 + dj3.1: django>=3.0,<=3.1 [testenv:develop] basepython = - python3.6 + python3.8 deps = -rrequirements.txt -rrequirements-dev.txt From a455e8480094e1f74a9d1802cbd68a40d5c366c9 Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk Date: Sun, 31 Jan 2021 19:08:44 +0200 Subject: [PATCH 05/13] Update for Django >= 2.0 <= 3.1 --- HISTORY.rst | 2 +- README.rst | 12 ++++++------ setup.py | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 09c64a5..d00582f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,7 +3,7 @@ History ------- -0.1.2 (2017-04-19) +0.1.2 (2021-01-30) ++++++++++++++++++ * Update for Django >= 2.0 <= 3.1 diff --git a/README.rst b/README.rst index 95c30e9..fdd669e 100644 --- a/README.rst +++ b/README.rst @@ -43,7 +43,7 @@ to render PDFs in the backend outside the request scope Quickstart ---------- -1. Include ``django-easy-pdf``, ``xhtml2pdf`` in your ``requirements.txt`` file. +1. Include ``django-easy-pdf3``, ``xhtml2pdf`` in your ``requirements.txt`` file. If you are on Python 3 you need to install the latest version of Reportlab and the beta version of xhtml2pdf:: $ pip install xhtml2pdf>=0.2b1 @@ -90,9 +90,9 @@ script from the cloned repository or through Docker with ``make demo``. Dependencies ------------ -``django-easy-pdf`` depends on: +``django-easy-pdf3`` depends on: - - ``django>=1.10`` + - ``django>=2.0`` - ``xhtml2pdf>=0.2b1`` - ``reportlab`` @@ -100,14 +100,14 @@ Dependencies License ------- -``django-easy-pdf`` is released under the MIT license. +``django-easy-pdf3`` is released under the MIT license. Other Resources --------------- -- GitHub repository - https://github.com/nigma/django-easy-pdf -- PyPi Package site - https://pypi.python.org/pypi/django-easy-pdf +- GitHub repository - https://github.com/olksndrdevhub/django-easy-pdf3 +- PyPi Package site - https://pypi.python.org/pypi/django-easy-pdf3 - Docs - https://django-easy-pdf.readthedocs.io/ diff --git a/setup.py b/setup.py index 4204e5f..2af782b 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ import setuptools -version = "0.1.2-beta.1" +version = "0.1.2" if sys.argv[-1] == "publish": os.system("python setup.py sdist bdist_wheel upload") @@ -24,7 +24,7 @@ history = open("HISTORY.rst").read().replace(".. :changelog:", "") setuptools.setup( - name="django-easy-pdf3-oleksandrdevhub", + name="django-easy-pdf3", version=version, description="""Django PDF views, the easy way""", license="MIT", @@ -46,7 +46,7 @@ zip_safe=False, keywords="django-easy-pdf3", classifiers=[ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", From 1227ba18d0caab25bbaaee1214a200940fc95c48 Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk <47930925+olksndrdevhub@users.noreply.github.com> Date: Thu, 18 Mar 2021 15:05:01 +0200 Subject: [PATCH 06/13] U README.md --- README.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index fdd669e..8f73775 100644 --- a/README.rst +++ b/README.rst @@ -7,13 +7,13 @@ Django PDF rendering, the easy way. :target: https://circleci.com/gh/nigma/django-easy-pdf/tree/master :alt: Build Status .. image:: https://img.shields.io/pypi/v/django-easy-pdf.svg - :target: https://pypi.python.org/pypi/django-easy-pdf/ + :target: https://pypi.python.org/pypi/django-easy-pdf3/ :alt: Latest Version .. image:: https://img.shields.io/badge/wheel-yes-green.svg - :target: https://pypi.python.org/pypi/django-easy-pdf/ + :target: https://pypi.python.org/pypi/django-easy-pdf3/ :alt: Wheel .. image:: https://img.shields.io/pypi/l/django-easy-pdf.svg - :target: https://pypi.python.org/pypi/django-easy-pdf/ + :target: https://pypi.python.org/pypi/django-easy-pdf3/ :alt: License Developed at `en.ig.ma software shop `_. From 0b43f5b8b1127ea8ba0f5f77e749d7ac7aed7752 Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk <47930925+olksndrdevhub@users.noreply.github.com> Date: Thu, 18 Mar 2021 15:09:24 +0200 Subject: [PATCH 07/13] U README.md --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 8f73775..092aea1 100644 --- a/README.rst +++ b/README.rst @@ -6,13 +6,13 @@ Django PDF rendering, the easy way. .. image:: https://circleci.com/gh/nigma/django-easy-pdf/tree/master.svg?style=svg :target: https://circleci.com/gh/nigma/django-easy-pdf/tree/master :alt: Build Status -.. image:: https://img.shields.io/pypi/v/django-easy-pdf.svg +.. image:: https://img.shields.io/pypi/v/django-easy-pdf3/ :target: https://pypi.python.org/pypi/django-easy-pdf3/ :alt: Latest Version .. image:: https://img.shields.io/badge/wheel-yes-green.svg :target: https://pypi.python.org/pypi/django-easy-pdf3/ :alt: Wheel -.. image:: https://img.shields.io/pypi/l/django-easy-pdf.svg +.. image:: https://img.shields.io/pypi/l/django-easy-pdf3 :target: https://pypi.python.org/pypi/django-easy-pdf3/ :alt: License From 7de87b77a166c8620aef71de740832868bc34670 Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk <47930925+olksndrdevhub@users.noreply.github.com> Date: Thu, 18 Mar 2021 15:16:30 +0200 Subject: [PATCH 08/13] U README.md --- README.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 092aea1..aefc3e5 100644 --- a/README.rst +++ b/README.rst @@ -2,11 +2,12 @@ Django PDF rendering ==================== Django PDF rendering, the easy way. +https://img.shields.io/pypi/v/django-easy-pdf3 .. image:: https://circleci.com/gh/nigma/django-easy-pdf/tree/master.svg?style=svg :target: https://circleci.com/gh/nigma/django-easy-pdf/tree/master :alt: Build Status -.. image:: https://img.shields.io/pypi/v/django-easy-pdf3/ +.. image:: https://img.shields.io/pypi/v/django-easy-pdf3 :target: https://pypi.python.org/pypi/django-easy-pdf3/ :alt: Latest Version .. image:: https://img.shields.io/badge/wheel-yes-green.svg From 120075ee55840b95ccbcfea39dd93bc439dc7b78 Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk <47930925+olksndrdevhub@users.noreply.github.com> Date: Thu, 18 Mar 2021 15:17:23 +0200 Subject: [PATCH 09/13] U README.md --- README.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/README.rst b/README.rst index aefc3e5..97298c5 100644 --- a/README.rst +++ b/README.rst @@ -2,7 +2,6 @@ Django PDF rendering ==================== Django PDF rendering, the easy way. -https://img.shields.io/pypi/v/django-easy-pdf3 .. image:: https://circleci.com/gh/nigma/django-easy-pdf/tree/master.svg?style=svg :target: https://circleci.com/gh/nigma/django-easy-pdf/tree/master From 26e23e7077960832347b8c8d3a04929a1bfce5ab Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk Date: Sat, 11 Dec 2021 21:57:44 +0200 Subject: [PATCH 10/13] Add Django4 support --- demo.py | 5 +++-- docs/usage.rst | 2 +- easy_pdf/rendering.py | 4 ++-- tests/urls.py | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/demo.py b/demo.py index 5ec710f..9006a69 100644 --- a/demo.py +++ b/demo.py @@ -15,7 +15,7 @@ logging.basicConfig(level=logging.DEBUG) from django.conf import settings -from django.conf.urls import url +from django.urls import re_path from django.core.wsgi import get_wsgi_application from django.utils.timezone import now as tznow @@ -49,6 +49,7 @@ def rel(*path): STATIC_ROOT=os.path.abspath(rel('tests', 'static')), STATIC_URL='/static/', ROOT_URLCONF=basename, + SECRET_KEY='foo', WSGI_APPLICATION='{}.application'.format(basename), ALLOWED_HOSTS=[ '127.0.0.1', @@ -73,7 +74,7 @@ def get_context_data(self, **kwargs): urlpatterns = [ - url(r'^$', DemoPDFView.as_view()) + re_path(r'^$', DemoPDFView.as_view()) ] application = get_wsgi_application() diff --git a/docs/usage.rst b/docs/usage.rst index 835f336..151252a 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -72,7 +72,7 @@ rendered from the HTML template. .. code-block:: python urlpatterns = [ - url(r'^hello.pdf$', HelloPDFView.as_view()) + re_path(r'^hello.pdf$', HelloPDFView.as_view()) ] You can also use a mixin to output PDF from Django generic views:: diff --git a/easy_pdf/rendering.py b/easy_pdf/rendering.py index ee68ffa..3c2e133 100644 --- a/easy_pdf/rendering.py +++ b/easy_pdf/rendering.py @@ -8,7 +8,7 @@ from django.conf import settings from django.template import loader from django.http import HttpResponse -from django.utils.http import urlquote +from django.utils.html import smart_urlquote try: from django.utils.six import BytesIO @@ -96,7 +96,7 @@ def encode_filename(filename): # TODO: http://greenbytes.de/tech/webdav/rfc6266.html # TODO: http://greenbytes.de/tech/tc2231/ - quoted = urlquote(filename) + quoted = smart_urlquote(filename) if quoted == filename: return "filename=%s" % filename else: diff --git a/tests/urls.py b/tests/urls.py index 366854a..6d7ae9e 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -1,12 +1,12 @@ # coding=utf-8 -from django.conf.urls import url +from django.urls import re_path from easy_pdf.views import PDFTemplateView from .views import DemoPDFView, PDFUserDetailView urlpatterns = [ - url(r'^demo/$', DemoPDFView.as_view()), - url(r'^simple/$', PDFTemplateView.as_view(template_name='simple.html')), - url(r'^user/(?P\d+)/$', PDFUserDetailView.as_view()), + re_path(r'^demo/$', DemoPDFView.as_view()), + re_path(r'^simple/$', PDFTemplateView.as_view(template_name='simple.html')), + re_path(r'^user/(?P\d+)/$', PDFUserDetailView.as_view()), ] From 6f231d0e5dc5760783972cb29990eb28378e0ab5 Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk Date: Sun, 12 Dec 2021 13:05:13 +0200 Subject: [PATCH 11/13] U package configuration and docs --- HISTORY.rst | 5 +++++ README.rst | 5 +++-- setup.py | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index d00582f..90a81ad 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,11 @@ History ------- +0.1.4 (2021-01-30) +++++++++++++++++++ + +* Add Django 4 support + 0.1.2 (2021-01-30) ++++++++++++++++++ diff --git a/README.rst b/README.rst index 97298c5..025a699 100644 --- a/README.rst +++ b/README.rst @@ -20,11 +20,12 @@ Developed at `en.ig.ma software shop `_. Development Version ------------------- -Note: This fork support Django>=3.0 with "xhtml2pdf" as rendering backend! Support with WeasyPrint is not tested! +Add support for Django 4 in 0.1.4 version + +Note: This fork support Django>=2.0 with "xhtml2pdf" as rendering backend! Support with WeasyPrint is not tested! Note: A new PDF rendering backend using WeasyPrint for more accurate rendering is in development under the develop branch. See https://github.com/nigma/django-easy-pdf/pull/34 for changes, testing and discussion. -If you rely on the ``xhtml2pdf`` rendering backend and templates pin the package version to ``django-easy-pdf>=0.1.1<0.2.0``. Overview -------- diff --git a/setup.py b/setup.py index 2af782b..f1ebf98 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ import setuptools -version = "0.1.2" +version = "0.1.4" if sys.argv[-1] == "publish": os.system("python setup.py sdist bdist_wheel upload") @@ -60,6 +60,7 @@ "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Topic :: Software Development :: Libraries :: Python Modules" ], ) From 4810a27418e0a9736432341dffeb6e0af1f70ac7 Mon Sep 17 00:00:00 2001 From: Oleksandr Romaniuk Date: Sun, 12 Dec 2021 13:18:32 +0200 Subject: [PATCH 12/13] U package configuration and docs --- README.rst | 11 +++++++---- setup.py | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 025a699..8fe9f95 100644 --- a/README.rst +++ b/README.rst @@ -20,7 +20,7 @@ Developed at `en.ig.ma software shop `_. Development Version ------------------- -Add support for Django 4 in 0.1.4 version +Info: Add support for Django 4 in 0.1.4 version Note: This fork support Django>=2.0 with "xhtml2pdf" as rendering backend! Support with WeasyPrint is not tested! Note: A new PDF rendering backend using WeasyPrint for more accurate rendering is in development under the develop branch. @@ -44,10 +44,12 @@ to render PDFs in the backend outside the request scope Quickstart ---------- -1. Include ``django-easy-pdf3``, ``xhtml2pdf`` in your ``requirements.txt`` file. - If you are on Python 3 you need to install the latest version of Reportlab and the beta version of xhtml2pdf:: - $ pip install xhtml2pdf>=0.2b1 +1. Install django-easy-pdf3 package: + + $ pip install django-easy-pdf3 + + or add ``django-easy-pdf3`` to your requirements.txt 2. Add ``easy_pdf`` to ``INSTALLED_APPS``. @@ -110,6 +112,7 @@ Other Resources - GitHub repository - https://github.com/olksndrdevhub/django-easy-pdf3 - PyPi Package site - https://pypi.python.org/pypi/django-easy-pdf3 - Docs - https://django-easy-pdf.readthedocs.io/ +- Bug Tracker - https://github.com/olksndrdevhub/django-easy-pdf3/issues Commercial Support diff --git a/setup.py b/setup.py index f1ebf98..9a3d50e 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,9 @@ maintainer='Romaniuk Oleksandr', maintainer_email='oleksandr.romaniuk@protonmail.com', url="https://github.com/olksndrdevhub/django-easy-pdf3", + project_urls={ + "Bug Tracker": "https://github.com/olksndrdevhub/django-easy-pdf3/issues", + }, long_description=readme + "\n\n" + history, packages=[ "easy_pdf", From e6a96a215ba6039130f785a11affde1b571db5f3 Mon Sep 17 00:00:00 2001 From: Domenico Date: Sun, 12 Dec 2021 11:09:56 -0600 Subject: [PATCH 13/13] clean --- .editorconfig | 21 --------------------- .gitattributes | 1 - CONTRIBUTING.rst | 2 +- HISTORY.rst | 2 +- circle.yml | 32 -------------------------------- demo.py | 10 +--------- docs/conf.py | 2 -- easy_pdf/__init__.py | 6 +----- easy_pdf/apps.py | 2 -- easy_pdf/exceptions.py | 20 +++++--------------- easy_pdf/models.py | 1 - easy_pdf/rendering.py | 17 ++++------------- easy_pdf/tests.py | 2 -- easy_pdf/views.py | 6 +----- requirements-dev.txt | 13 ------------- requirements.txt | 9 --------- runtests.py | 1 - setup.py | 28 +++++++++++++++++++--------- tests/__init__.py | 1 - tests/models.py | 1 - tests/test_settings.py | 2 -- tests/tests.py | 2 -- tests/urls.py | 3 +-- tests/views.py | 2 -- tox.ini | 29 +++++++---------------------- 25 files changed, 41 insertions(+), 174 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .gitattributes delete mode 100644 circle.yml delete mode 100644 requirements-dev.txt delete mode 100644 requirements.txt diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index de76a59..0000000 --- a/.editorconfig +++ /dev/null @@ -1,21 +0,0 @@ -# http://EditorConfig.org - -root = true - -[*] -end_of_line = lf -insert_final_newline = true - -[*.{py,rst,yml}] -charset = utf-8 - -[*.py] -indent_style = space -indent_size = 4 - -[*.yml] -indent_style = space -indent_size = 2 - -[Makefile] -indent_style = tab diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 176a458..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index a84d6d1..0afc77f 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -13,7 +13,7 @@ Types of Contributions Report Bugs ----------- -Report bugs at https://github.com/nigma/django-easy-pdf/issues. +Report bugs at https://github.com/olksndrdevhub/django-easy-pdf3/issues. If you are reporting a bug, please include: diff --git a/HISTORY.rst b/HISTORY.rst index 90a81ad..d608a01 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -21,4 +21,4 @@ History 0.1.0 (2014-01-24) ++++++++++++++++++ -* First release \ No newline at end of file +* First release diff --git a/circle.yml b/circle.yml deleted file mode 100644 index d5b0de8..0000000 --- a/circle.yml +++ /dev/null @@ -1,32 +0,0 @@ -machine: - services: - - docker - -general: - artifacts: - - "./dist" - - "./artifacts" - -dependencies: - pre: - - docker --version - override: - - pip install tox tox-pyenv - - pyenv local 2.7.12 3.4.4 3.5.3 3.6.1 - - make docker-build - -test: - override: - - make test-all - - make ci-docker-test - - make ci-docker-docs - -deployment: - master: - branch: master - commands: - - make ci-docker-dist - develop: - branch: develop - commands: - - make ci-docker-dist diff --git a/demo.py b/demo.py index 9006a69..69f1f5e 100644 --- a/demo.py +++ b/demo.py @@ -1,13 +1,5 @@ #!/bin/env python -# coding=utf-8 - -""" -Demo script. Run: - -python.exe demo.py -""" - -from __future__ import absolute_import, division, print_function, unicode_literals +"""Demo script. Run: python.exe demo.py""" import logging import os diff --git a/docs/conf.py b/docs/conf.py index f512d59..446f409 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- -# # django-easy-pdf documentation build configuration file, created by # sphinx-quickstart on Sun Jan 12 20:56:38 2014. # diff --git a/easy_pdf/__init__.py b/easy_pdf/__init__.py index 47d5252..7525d19 100644 --- a/easy_pdf/__init__.py +++ b/easy_pdf/__init__.py @@ -1,5 +1 @@ -# coding=utf-8 - -__version__ = '0.1.2.dev1' - -default_app_config = 'easy_pdf.apps.EasyPDFConfig' +__version__ = '0.1.4' diff --git a/easy_pdf/apps.py b/easy_pdf/apps.py index 3178a81..dff60e2 100644 --- a/easy_pdf/apps.py +++ b/easy_pdf/apps.py @@ -1,5 +1,3 @@ -# coding=utf-8 - from django.apps import AppConfig diff --git a/easy_pdf/exceptions.py b/easy_pdf/exceptions.py index 5e5f9ad..8d9f74a 100644 --- a/easy_pdf/exceptions.py +++ b/easy_pdf/exceptions.py @@ -1,26 +1,16 @@ -# coding=utf-8 - -from __future__ import absolute_import, division, print_function, unicode_literals - - -class EasyPDFError(Exception): - """ - Base error class +class EasyPDFError(BaseException): + """Base error class """ class UnsupportedMediaPathException(EasyPDFError): - """ - Resource not found or unavailable - """ + """Resource not found or unavailable""" class PDFRenderingError(EasyPDFError): - """ - PDF Rendering error. Check HTML template for errors. - """ + """PDF Rendering error. Check HTML template for errors""" def __init__(self, message, content, log, *args, **kwargs): - super(PDFRenderingError, self).__init__(message, *args, **kwargs) + super().__init__(message, *args, **kwargs) self.content = content self.log = log diff --git a/easy_pdf/models.py b/easy_pdf/models.py index 9bad579..e69de29 100644 --- a/easy_pdf/models.py +++ b/easy_pdf/models.py @@ -1 +0,0 @@ -# coding=utf-8 diff --git a/easy_pdf/rendering.py b/easy_pdf/rendering.py index 3c2e133..7e13f78 100644 --- a/easy_pdf/rendering.py +++ b/easy_pdf/rendering.py @@ -1,24 +1,15 @@ -# coding=utf-8 - -from __future__ import absolute_import, division, print_function, unicode_literals - import logging import os +from io import BytesIO +import xhtml2pdf.default from django.conf import settings -from django.template import loader from django.http import HttpResponse +from django.template import loader from django.utils.html import smart_urlquote - -try: - from django.utils.six import BytesIO -except ImportError: - from six import BytesIO - -import xhtml2pdf.default from xhtml2pdf import pisa -from .exceptions import UnsupportedMediaPathException, PDFRenderingError +from .exceptions import PDFRenderingError, UnsupportedMediaPathException logger = logging.getLogger("app.pdf") logger_x2p = logging.getLogger("app.pdf.xhtml2pdf") diff --git a/easy_pdf/tests.py b/easy_pdf/tests.py index a159ad0..d2f2d44 100644 --- a/easy_pdf/tests.py +++ b/easy_pdf/tests.py @@ -1,5 +1,3 @@ -# coding=utf-8 - from django.test import RequestFactory from django.test.testcases import TestCase diff --git a/easy_pdf/views.py b/easy_pdf/views.py index 26daeb0..5cfb020 100644 --- a/easy_pdf/views.py +++ b/easy_pdf/views.py @@ -1,10 +1,6 @@ -# coding=utf-8 - -from __future__ import absolute_import, division, print_function, unicode_literals - import copy -from django.views.generic.base import TemplateResponseMixin, ContextMixin, View +from django.views.generic.base import ContextMixin, TemplateResponseMixin, View from .rendering import render_to_pdf_response diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 45173a8..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,13 +0,0 @@ -pip>=9.0.1 -setuptools>=34.3.3 -wheel>=0.29.0 -django-nose -coverage -gunicorn -flake8>=3.3.0 -mccabe>=0.6.1 -pycodestyle>=2.3.1 -pyflakes>=1.5.0 -mypy>=0.501 -tox -twine>=1.8.1 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index b18a785..0000000 --- a/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -django>=2.0 -xhtml2pdf>=0.2b1 -six>=1.15.0 -# Dependencies of xhtml2pdf -html5lib>=1.0b10 -httplib2>=0.8 -pyPdf2>=1.26 -Pillow>=2.4.0 -reportlab>=3 diff --git a/runtests.py b/runtests.py index ed27485..5da7bba 100644 --- a/runtests.py +++ b/runtests.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# coding=utf-8 import os import sys diff --git a/setup.py b/setup.py index 9a3d50e..2e27856 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- import os import sys @@ -42,10 +41,24 @@ ], include_package_data=True, install_requires=[ - "django>=2.0", - "xhtml2pdf>=0.2b1", - "reportlab>=3" + "django", + "xhtml2pdf", + "reportlab" ], + extras_require={ + 'test': ( + 'django-nose', + 'coverage', + 'flake8', + 'isort', + 'mccabe', + 'pycodestyle', + 'pyflakes', + 'mypy', + 'tox', + 'twine', + ) + }, zip_safe=False, keywords="django-easy-pdf3", classifiers=[ @@ -56,14 +69,11 @@ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Natural Language :: English", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.0", "Topic :: Software Development :: Libraries :: Python Modules" ], ) diff --git a/tests/__init__.py b/tests/__init__.py index 9bad579..e69de29 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +0,0 @@ -# coding=utf-8 diff --git a/tests/models.py b/tests/models.py index 9bad579..e69de29 100644 --- a/tests/models.py +++ b/tests/models.py @@ -1 +0,0 @@ -# coding=utf-8 diff --git a/tests/test_settings.py b/tests/test_settings.py index 19e8eb0..fa26a37 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -1,5 +1,3 @@ -# coding=utf-8 - import logging import os import sys diff --git a/tests/tests.py b/tests/tests.py index 1140b2a..8f22811 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -1,5 +1,3 @@ -# coding=utf-8 - from django.contrib.auth import get_user_model from django.test.testcases import TestCase diff --git a/tests/urls.py b/tests/urls.py index 6d7ae9e..8d73a0a 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -1,8 +1,7 @@ -# coding=utf-8 - from django.urls import re_path from easy_pdf.views import PDFTemplateView + from .views import DemoPDFView, PDFUserDetailView urlpatterns = [ diff --git a/tests/views.py b/tests/views.py index b2ebe54..79a50ac 100644 --- a/tests/views.py +++ b/tests/views.py @@ -1,5 +1,3 @@ -# coding=utf-8 - from django.contrib.auth import get_user_model from django.utils.timezone import now from django.views.generic import DetailView diff --git a/tox.ini b/tox.ini index 02df1c0..3eba4f2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,30 +1,15 @@ [tox] envlist = - py{2.7,3.4,3.5,3.6}-dj{1.10,1.11} - develop + py{38,39}-d{32,40} [testenv] -basepython = - py2.7: python2.7 - py3.4: python3.4 - py3.5: python3.5 - py3.6: python3.6 - py3.8: python3.8 commands = {envpython} -c "from django import VERSION; print('%s %s' % ('Django Version', VERSION))" + flake8 easy_pdf + isort -rc easy_pdf {envpython} runtests.py deps = - xhtml2pdf>=0.2b1 - django-nose - coverage - dj2.0: django>=2.0,<3.0 - dj3.1: django>=3.0,<=3.1 - -[testenv:develop] -basepython = - python3.8 -deps = - -rrequirements.txt - -rrequirements-dev.txt -commands = - flake8 easy_pdf tests + d32: django==3.2.* + d40: django==4.0.* +extras = + test \ No newline at end of file