Skip to content

Commit 2443ca8

Browse files
authored
Merge pull request #65 from helloflask/release-2.0
Remove deprecated code and release 2.0.0 version
2 parents eeded3b + 029a6ec commit 2443ca8

File tree

15 files changed

+36
-234
lines changed

15 files changed

+36
-234
lines changed

.github/workflows/tests.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ on:
33
push:
44
branches:
55
- main
6+
- master
67
paths-ignore:
78
- 'docs/**'
89
- '*.md'
910
- '*.rst'
1011
pull_request:
1112
branches:
1213
- main
14+
- master
1315
jobs:
1416
tests:
1517
name: ${{ matrix.name }}
@@ -18,10 +20,13 @@ jobs:
1820
fail-fast: false
1921
matrix:
2022
include:
21-
- {name: '3.10', python: '3.10', tox: 'py310,py-babelex,py-no-babel'}
23+
- {name: '3.12', python: '3.12', tox: 'py312'}
24+
- {name: '3.11', python: '3.11', tox: 'py311'}
25+
- {name: '3.10', python: '3.10', tox: 'py310'}
2226
- {name: '3.9', python: '3.9', tox: py39}
2327
- {name: '3.8', python: '3.8', tox: py38}
2428
- {name: '3.7', python: '3.7', tox: py37}
29+
- {name: 'Lint', python: '3.12', tox: lint}
2530
steps:
2631
- uses: actions/checkout@v3
2732
- uses: actions/setup-python@v4

CHANGES.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ released date: --
77

88
WARNING: **New major upstream release (backwards incompatible!).**
99

10-
* Remove ``dropzone.load()`` method.
10+
* Remove the deprecated ``dropzone.load()`` method.
1111
* Added more options to customize messages.
1212
* Drop Python 2 support.
1313
* Add an ``id`` parameter for ``dropzone.style()`` to support
14-
customize unique styles for multiple dropzones in one page (`#53 <https://github.com/greyli/flask-dropzone/pull/53>`_).
14+
customize unique styles for multiple dropzones in one page (`#53 <https://github.com/helloflask/flask-dropzone/pull/53>`_).
15+
* Upgrade Dropzone.js to 5.9.3 version.
1516

1617
1.6.0
1718
-----
@@ -24,7 +25,7 @@ released date: 2021/5/1
2425
-----
2526
released date: 2019/8/4
2627

27-
* Fix CSRF protect bug when in form (`#29 <https://github.com/greyli/flask-dropzone/issues/29>`_).
28+
* Fix CSRF protect bug when in form (`#29 <https://github.com/helloflask/flask-dropzone/issues/29>`_).
2829

2930
1.5.3
3031
-----
@@ -81,7 +82,7 @@ released date: 2018/5/28
8182
released date: 2018/3/23
8283

8384
* Add support to use custom resources with ``js_url`` and ``css_url`` param in ``load()``.
84-
* Fix built-in static bug (`#11 <https://github.com/greyli/flask-dropzone/issues/11>`_).
85+
* Fix built-in static bug (`#11 <https://github.com/helloflask/flask-dropzone/issues/11>`_).
8586
* Use package instead of module.
8687

8788
1.4.2

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Flask-Dropzone
2+
3+
[![GitHub Actions Build Status](https://github.com/helloflask/flask-dropzone/actions/workflows/tests.yaml/badge.svg)](https://github.com/helloflask/flask-dropzone/actions)
4+
[![PyPI](https://img.shields.io/pypi/v/Flask-Dropzone)](https://pypi.org/project/Flask-Dropzone/)
5+
26
Upload files in Flask application with [Dropzone.js](http://www.dropzonejs.com/).
37

48
NOTICE: This extension is built for simple usage, if you need more flexibility, please use Dropzone.js directly.
@@ -7,7 +11,7 @@ NOTICE: This extension is built for simple usage, if you need more flexibility,
711

812
* [Documentation](https://flask-dropzone.readthedocs.io/en/latest/)
913
* [PyPI](https://pypi.org/project/Flask-Dropzone/)
10-
* [Examples](https://github.com/greyli/flask-dropzone/tree/master/examples)
14+
* [Examples](https://github.com/helloflask/flask-dropzone/tree/master/examples)
1115

1216
## License
1317

docs/_templates/sidebarintro.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ <h3>Useful Links</h3>
66
<ul>
77
<li><a href="http://flask.pocoo.org/">Flask</a></li>
88
<li><a href="http://pypi.org/project/Flask-dropzone">Flask-Dropzone @ PyPI</a></li>
9-
<li><a href="http://github.com/greyli/flask-dropzone">Flask-Dropzone @ GitHub</a></li>
10-
<li><a href="http://github.com/greyli/flask-dropzone/issues">Issue Tracker</a></li>
9+
<li><a href="http://github.com/helloflask/flask-dropzone">Flask-Dropzone @ GitHub</a></li>
10+
<li><a href="http://github.com/helloflask/flask-dropzone/issues">Issue Tracker</a></li>
1111
<li><a href="http://greyli.com/flask-dropzone/">中文介绍</a></li>
1212
</ul>

docs/basic.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ In addition to manage and load resources by yourself
5252
{{ dropzone.load_js() }}
5353
</body>
5454
55-
.. tip::
56-
There is a ``dropzone.load()`` method that was a combination of
57-
``dropzone.load_css()`` and ``dropzone.load_js()``, but we recommend not
58-
to use this method for page load performance consideration. Also,
59-
``dropzone.load()`` will be removed in the near future.
60-
6155
You can assign the version of Dropzone.js through ``version`` argument,
6256
the default value is ``5.2.0``. And, you can pass ``css_url`` and
6357
``js_url`` separately to customize resources URL.

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
html_theme_options = {
8787
# 'github_user': 'greyli',
8888
'index_logo': 'flask-dropzone.png',
89-
# 'github_fork': 'greyli/flask-ckeditor',
89+
# 'github_fork': 'helloflask/flask-ckeditor',
9090
# 'description': 'Create social share component in Jinja2 template based on share.js.',
9191
}
9292

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Maintainers:
5656
- `yuxiaoy <https://github.com/Yuxiaoy1>`_
5757

5858
See also the list of
59-
`contributors <https://github.com/greyli/flask-dropzone/contributors>`_ on GitHub.
59+
`contributors <https://github.com/helloflask/flask-dropzone/contributors>`_ on GitHub.
6060

6161
License
6262
-------

examples/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Try Examples
33

44
Open a terminal, type the commands below one by one::
55

6-
$ git clone https://github.com/greyli/flask-dropzone
6+
$ git clone https://github.com/helloflask/flask-dropzone
77
$ cd flask-dropzone/examples
88
$ pip install -r requirements.txt
99
$ python basic/app.py

flask_dropzone/__init__.py

Lines changed: 4 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
"""
3-
flask_dropzone
4-
~~~~~~~~~~~~~~
5-
6-
:author: Grey Li <[email protected]>
7-
:copyright: (c) 2017 by Grey Li.
8-
:license: MIT, see LICENSE for more details.
9-
"""
101
import warnings
112

123
from flask import Blueprint, current_app, render_template_string, url_for
@@ -26,147 +17,9 @@
2617

2718

2819
class _Dropzone(object):
29-
@staticmethod
30-
def load(js_url="", css_url="", version="5.2.0"):
31-
"""Load Dropzone resources with given version and init dropzone configuration.
32-
33-
.. versionchanged:: 1.4.3
34-
Added ``js_url`` and ``css_url`` parameters to pass custom resource URL.
35-
36-
.. versionchanged:: 1.4.4
37-
This method was deprecated due to inflexible. Now it's divided into three methods:
38-
1. Use ``load_css()`` to load css resources.
39-
2. Use ``load_js()`` to load js resources.
40-
3. Use ``config()`` to configure Dropzone.
41-
42-
:param js_url: The JavaScript url for Dropzone.js.
43-
:param css_url: The CSS url for Dropzone.js.
44-
:param version: The version of Dropzone.js.
45-
"""
46-
warnings.warn("The method will be removed in 2.0, see docs for more details.")
47-
js_filename = "dropzone.min.js"
48-
css_filename = "dropzone.min.css"
49-
50-
upload_multiple = current_app.config["DROPZONE_UPLOAD_MULTIPLE"]
51-
parallel_uploads = current_app.config["DROPZONE_PARALLEL_UPLOADS"]
52-
53-
if upload_multiple in [True, "true", "True", 1]:
54-
upload_multiple = "true"
55-
else:
56-
upload_multiple = "false"
57-
58-
serve_local = current_app.config["DROPZONE_SERVE_LOCAL"]
59-
size = current_app.config["DROPZONE_MAX_FILE_SIZE"]
60-
param = current_app.config["DROPZONE_INPUT_NAME"]
61-
redirect_view = current_app.config["DROPZONE_REDIRECT_VIEW"]
62-
63-
if redirect_view is not None:
64-
redirect_js = """
65-
this.on("queuecomplete", function(file) {
66-
// Called when all files in the queue finish uploading.
67-
window.location = "%s";
68-
});""" % url_for(redirect_view)
69-
else:
70-
redirect_js = ""
71-
72-
if not current_app.config["DROPZONE_ALLOWED_FILE_CUSTOM"]:
73-
allowed_type = allowed_file_extensions[
74-
current_app.config["DROPZONE_ALLOWED_FILE_TYPE"]
75-
]
76-
else:
77-
allowed_type = current_app.config["DROPZONE_ALLOWED_FILE_TYPE"]
78-
79-
max_files = current_app.config["DROPZONE_MAX_FILES"]
80-
default_message = current_app.config["DROPZONE_DEFAULT_MESSAGE"]
81-
invalid_file_type = current_app.config["DROPZONE_INVALID_FILE_TYPE"]
82-
file_too_big = current_app.config["DROPZONE_FILE_TOO_BIG"]
83-
server_error = current_app.config["DROPZONE_SERVER_ERROR"]
84-
browser_unsupported = current_app.config["DROPZONE_BROWSER_UNSUPPORTED"]
85-
max_files_exceeded = current_app.config["DROPZONE_MAX_FILE_EXCEED"]
86-
cancelUpload = current_app.config["DROPZONE_CANCEL_UPLOAD"]
87-
removeFile = current_app.config["DROPZONE_REMOVE_FILE"]
88-
cancelConfirmation = current_app.config["DROPZONE_CANCEL_CONFIRMATION"]
89-
uploadCanceled = current_app.config["DROPZONE_UPLOAD_CANCELED"]
90-
91-
timeout = current_app.config["DROPZONE_TIMEOUT"]
92-
if timeout:
93-
timeout_js = "timeout: %d," % timeout
94-
else:
95-
timeout_js = ""
96-
97-
if serve_local:
98-
js = '<script src="%s"></script>\n' % url_for(
99-
"dropzone.static", filename=js_filename
100-
)
101-
css = '<link rel="stylesheet" href="%s" type="text/css">\n' % url_for(
102-
"dropzone.static", filename=css_filename
103-
)
104-
else:
105-
js = (
106-
'<script src="https://cdn.jsdelivr.net/npm/dropzone@%s/dist/%s"></script>\n'
107-
% (version, js_filename)
108-
)
109-
css = (
110-
'<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dropzone@%s/dist/min/%s"'
111-
' type="text/css">\n' % (version, css_filename)
112-
)
113-
114-
if js_url:
115-
js = '<script src="%s"></script>\n' % js_url
116-
if css_url:
117-
css = '<link rel="stylesheet" href="%s" type="text/css">\n' % css_url
118-
119-
return Markup(
120-
"""
121-
%s%s<script>
122-
Dropzone.options.myDropzone = {
123-
init: function() {%s},
124-
uploadMultiple: %s,
125-
parallelUploads: %d,
126-
paramName: "%s", // The name that will be used to transfer the file
127-
maxFilesize: %d, // MB
128-
acceptedFiles: "%s",
129-
maxFiles: %s,
130-
dictDefaultMessage: "%s", // message display on drop area
131-
dictFallbackMessage: "%s",
132-
dictInvalidFileType: "%s",
133-
dictFileTooBig: "%s",
134-
dictResponseError: "%s",
135-
dictMaxFilesExceeded: "%s",
136-
dictCancelUpload: "%s",
137-
dictRemoveFile: "%s",
138-
dictCancelUploadConfirmation: "%s",
139-
dictUploadCanceled: "%s",
140-
%s // timeout
141-
};
142-
</script>
143-
"""
144-
% (
145-
css,
146-
js,
147-
redirect_js,
148-
upload_multiple,
149-
parallel_uploads,
150-
param,
151-
size,
152-
allowed_type,
153-
max_files,
154-
default_message,
155-
browser_unsupported,
156-
invalid_file_type,
157-
file_too_big,
158-
server_error,
159-
max_files_exceeded,
160-
cancelUpload,
161-
removeFile,
162-
cancelConfirmation,
163-
uploadCanceled,
164-
timeout_js,
165-
)
166-
)
16720

16821
@staticmethod
169-
def load_css(css_url=None, version="5.9.2"):
22+
def load_css(css_url=None, version="5.9.3"):
17023
"""Load Dropzone's css resources with given version.
17124
17225
.. versionadded:: 1.4.4
@@ -192,7 +45,7 @@ def load_css(css_url=None, version="5.9.2"):
19245
return Markup(css)
19346

19447
@staticmethod
195-
def load_js(js_url=None, version="5.9.2"):
48+
def load_js(js_url=None, version="5.9.3"):
19649
"""Load Dropzone's js resources with given version.
19750
19851
.. versionadded:: 1.4.4
@@ -236,7 +89,8 @@ def config(
23689
:param redirect_url: The URL to redirect when upload complete.
23790
:param custom_init: Custom javascript code in ``init: function() {}``.
23891
:param custom_options: Custom javascript code in ``Dropzone.options.myDropzone = {}``.
239-
:param nonce: Pass a nonce value that is newhen embedding the JavaScript code into a Content Security Policy protected web page.
92+
:param nonce: Pass a nonce value that is newhen embedding the JavaScript code into
93+
a Content Security Policy protected web page.
24094
:param id: The id of the dropzone element, it must matches the ``id`` argument passed to
24195
``dropzone.create()`` if provided.
24296
:param **kwargs: Mirror configuration variable, lowercase and without prefix.

flask_dropzone/static/dropzone.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)