cone.fileupload 0.7__tar.gz → 0.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cone.fileupload-0.7 → cone_fileupload-0.8}/CHANGES.rst +10 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/LICENSE.rst +1 -1
- cone_fileupload-0.8/PKG-INFO +291 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/README.rst +2 -1
- {cone.fileupload-0.7 → cone_fileupload-0.8}/setup.cfg +3 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/setup.py +2 -2
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/tests.py +2 -1
- cone_fileupload-0.8/src/cone.fileupload.egg-info/PKG-INFO +291 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone.fileupload.egg-info/SOURCES.txt +1 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone.fileupload.egg-info/requires.txt +1 -1
- cone.fileupload-0.7/PKG-INFO +0 -266
- cone.fileupload-0.7/src/cone.fileupload.egg-info/PKG-INFO +0 -266
- {cone.fileupload-0.7 → cone_fileupload-0.8}/MANIFEST.in +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/__init__.py +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/__init__.py +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/__init__.py +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/actions.py +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/fileupload.pt +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/fileupload.py +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload/jquery.fileupload-process.js +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload/jquery.fileupload-ui.js +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload/jquery.fileupload-validate.js +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload/jquery.fileupload.css +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload/jquery.fileupload.js +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload/jquery.iframe-transport.js +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload/vendor/jquery.ui.widget.js +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload/vendor/tmpl.min.js +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload.css +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload.js +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload.min.js +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/templates.py +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/toolbar.pt +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/locale/cone.fileupload.pot +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/locale/de/LC_MESSAGES/cone.fileupload.mo +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/locale/de/LC_MESSAGES/cone.fileupload.po +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone.fileupload.egg-info/dependency_links.txt +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone.fileupload.egg-info/namespace_packages.txt +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone.fileupload.egg-info/not-zip-safe +0 -0
- {cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone.fileupload.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
Changes
|
|
2
2
|
=======
|
|
3
3
|
|
|
4
|
+
0.8 (2025-10-25)
|
|
5
|
+
----------------
|
|
6
|
+
|
|
7
|
+
- Pin upper versions of dependencies.
|
|
8
|
+
[rnix]
|
|
9
|
+
|
|
10
|
+
- Replace deprecated use of ``allow_non_node_children`` by ``child_constraints``.
|
|
11
|
+
[rnix]
|
|
12
|
+
|
|
13
|
+
|
|
4
14
|
0.7 (2022-01-19)
|
|
5
15
|
----------------
|
|
6
16
|
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cone.fileupload
|
|
3
|
+
Version: 0.8
|
|
4
|
+
Summary: jQuery File Upload integration for cone.app
|
|
5
|
+
Home-page: http://github.com/conestack/cone.fileuplaod
|
|
6
|
+
Author: Cone Contributors
|
|
7
|
+
Author-email: dev@conestack.org
|
|
8
|
+
License: Simplified BSD
|
|
9
|
+
Keywords: node pyramid cone web
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
13
|
+
License-File: LICENSE.rst
|
|
14
|
+
Requires-Dist: setuptools
|
|
15
|
+
Requires-Dist: cone.app<1.1.0,>=1.0.3
|
|
16
|
+
Provides-Extra: test
|
|
17
|
+
Requires-Dist: zope.testrunner; extra == "test"
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: author-email
|
|
20
|
+
Dynamic: classifier
|
|
21
|
+
Dynamic: description
|
|
22
|
+
Dynamic: home-page
|
|
23
|
+
Dynamic: keywords
|
|
24
|
+
Dynamic: license
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: provides-extra
|
|
27
|
+
Dynamic: requires-dist
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+
.. image:: https://img.shields.io/pypi/v/cone.fileupload.svg
|
|
31
|
+
:target: https://pypi.python.org/pypi/cone.fileupload
|
|
32
|
+
:alt: Latest PyPI version
|
|
33
|
+
|
|
34
|
+
.. image:: https://img.shields.io/pypi/dm/cone.fileupload.svg
|
|
35
|
+
:target: https://pypi.python.org/pypi/cone.fileupload
|
|
36
|
+
:alt: Number of PyPI downloads
|
|
37
|
+
|
|
38
|
+
.. image:: https://travis-ci.org/bluedynamics/cone.fileupload.svg?branch=master
|
|
39
|
+
:target: https://travis-ci.org/bluedynamics/cone.fileupload
|
|
40
|
+
|
|
41
|
+
.. image:: https://coveralls.io/repos/github/bluedynamics/cone.fileupload/badge.svg?branch=master
|
|
42
|
+
:target: https://coveralls.io/github/bluedynamics/cone.fileupload?branch=master
|
|
43
|
+
|
|
44
|
+
This package integrates
|
|
45
|
+
`jQueryFileUpload <https://github.com/blueimp/jQuery-File-Upload>`_ in cone.
|
|
46
|
+
|
|
47
|
+
Currently, version 10.32.0 is included.
|
|
48
|
+
|
|
49
|
+
Included files of jQuery File Upload:
|
|
50
|
+
|
|
51
|
+
* jquery.iframe-transport.js
|
|
52
|
+
* jquery.fileupload.js
|
|
53
|
+
* jquery.fileupload-process.js
|
|
54
|
+
* jquery.fileupload-ui.js
|
|
55
|
+
* jquery.fileupload-validate.js
|
|
56
|
+
|
|
57
|
+
Additionally, v3.20.0 of
|
|
58
|
+
`Javascript-Templates <https://github.com/blueimp/JavaScript-Templates>`_
|
|
59
|
+
is included.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Usage
|
|
63
|
+
-----
|
|
64
|
+
|
|
65
|
+
Since ``cone.app`` not knows about the underlying data, ``cone.fileupload``
|
|
66
|
+
only provides an abstract server implementation.
|
|
67
|
+
|
|
68
|
+
So first we need to provide a model.
|
|
69
|
+
|
|
70
|
+
.. code-block:: python
|
|
71
|
+
|
|
72
|
+
from cone.app.model import BaseNode
|
|
73
|
+
from pyramid.security import ALL_PERMISSIONS
|
|
74
|
+
from pyramid.security import Allow
|
|
75
|
+
from pyramid.security import Deny
|
|
76
|
+
from pyramid.security import Everyone
|
|
77
|
+
|
|
78
|
+
ACL = [
|
|
79
|
+
(Allow, 'role:manager', ['add', 'delete']),
|
|
80
|
+
(Allow, Everyone, ['login']),
|
|
81
|
+
(Deny, Everyone, ALL_PERMISSIONS),
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
class Container(BaseNode):
|
|
85
|
+
__acl__ = ACL
|
|
86
|
+
|
|
87
|
+
def __call__(self):
|
|
88
|
+
"""Persistence happens here.
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
class File(BaseNode):
|
|
92
|
+
__acl__ = ACL
|
|
93
|
+
|
|
94
|
+
# allow setting any value types
|
|
95
|
+
child_constraints = None
|
|
96
|
+
|
|
97
|
+
Now we need to provide a concrete ``FileUploadHandle`` implementation for
|
|
98
|
+
our model.
|
|
99
|
+
|
|
100
|
+
.. code-block:: python
|
|
101
|
+
|
|
102
|
+
from cone.fileupload.browser.fileupload import FileUploadHandle
|
|
103
|
+
from pyramid.view import view_config
|
|
104
|
+
|
|
105
|
+
@view_config(
|
|
106
|
+
name='fileupload_handle',
|
|
107
|
+
context=Container, # <- here the view gets bound to our model
|
|
108
|
+
accept='application/json',
|
|
109
|
+
renderer='json',
|
|
110
|
+
permission='add')
|
|
111
|
+
class ContainerFileUploadHandle(FileUploadHandle):
|
|
112
|
+
|
|
113
|
+
def create_file(self, stream, filename, mimetype):
|
|
114
|
+
# this function gets called for persisting uploaded files
|
|
115
|
+
file = self.model[filename] = File()
|
|
116
|
+
file['body'] = stream.read()
|
|
117
|
+
return {
|
|
118
|
+
'name': filename,
|
|
119
|
+
'size': len(file['body']),
|
|
120
|
+
'view_url': '/{0}'.format(file.name),
|
|
121
|
+
'download_url': '/{0}/download'.format(file.name),
|
|
122
|
+
'delete_url': '/{0}/filedelete_handle'.format(file.name),
|
|
123
|
+
'delete_type': 'GET',
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
def read_existing(self):
|
|
127
|
+
# this function gets called for initial reading of existing files
|
|
128
|
+
files = list()
|
|
129
|
+
for node in self.model.values():
|
|
130
|
+
files.append({
|
|
131
|
+
'name': node.name,
|
|
132
|
+
'size': len(node['body']),
|
|
133
|
+
'view_url': '/{0}'.format(node.name),
|
|
134
|
+
'download_url': '/{0}/download'.format(node.name),
|
|
135
|
+
'delete_url': '/{0}/filedelete_handle'.format(node.name),
|
|
136
|
+
'delete_type': 'GET',
|
|
137
|
+
})
|
|
138
|
+
return files
|
|
139
|
+
|
|
140
|
+
Optionally we might want to provide a custom fileupload tile for our model.
|
|
141
|
+
|
|
142
|
+
.. code-block:: python
|
|
143
|
+
|
|
144
|
+
from cone.tile import tile
|
|
145
|
+
from cone.fileupload.browser.fileupload import FileUploadTile
|
|
146
|
+
|
|
147
|
+
@tile(
|
|
148
|
+
name='fileupload',
|
|
149
|
+
path='cone.fileupload:browser/fileupload.pt',
|
|
150
|
+
interface=Container,
|
|
151
|
+
permission='add')
|
|
152
|
+
class ContainerFileUploadTile(FileUploadTile):
|
|
153
|
+
accept_file_types = r'/(\.|\/)(gif|jpg)$/i'
|
|
154
|
+
|
|
155
|
+
The file upload actions are either rendered as dedicated tile by name
|
|
156
|
+
``fileupload_toolbar`` or integrated into the context menu. If it's desired to
|
|
157
|
+
display the action in the context menu, ``fileupload_contextmenu_actions``
|
|
158
|
+
flag must be set on model ``properties``.
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
Contributors
|
|
162
|
+
============
|
|
163
|
+
|
|
164
|
+
- Robert Niederreiter
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
Changes
|
|
168
|
+
=======
|
|
169
|
+
|
|
170
|
+
0.8 (2025-10-25)
|
|
171
|
+
----------------
|
|
172
|
+
|
|
173
|
+
- Pin upper versions of dependencies.
|
|
174
|
+
[rnix]
|
|
175
|
+
|
|
176
|
+
- Replace deprecated use of ``allow_non_node_children`` by ``child_constraints``.
|
|
177
|
+
[rnix]
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
0.7 (2022-01-19)
|
|
181
|
+
----------------
|
|
182
|
+
|
|
183
|
+
- Modernize JavaScript setup.
|
|
184
|
+
|
|
185
|
+
- Add ``i18n_messages_src``, ``upload_template_src`` and
|
|
186
|
+
``download_template_src`` attributes to ``FileUploadTile``.
|
|
187
|
+
|
|
188
|
+
- Add optional ``download_url`` to file data dict.
|
|
189
|
+
|
|
190
|
+
- Remove ``thumbnailUrl`` from file data dict.
|
|
191
|
+
|
|
192
|
+
**Breaking Changes**
|
|
193
|
+
|
|
194
|
+
- Rename ``url`` to ``view_url`` in file data dict.
|
|
195
|
+
|
|
196
|
+
- Rename ``deleteUrl`` to ``delete_url`` in file data dict.
|
|
197
|
+
|
|
198
|
+
- Rename ``deleteType`` to ``delete_type`` in file data dict.
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
0.6 (2021-11-21)
|
|
202
|
+
----------------
|
|
203
|
+
|
|
204
|
+
- Fileupload actions optionally work from contextmenu.
|
|
205
|
+
[rnix]
|
|
206
|
+
|
|
207
|
+
- Move button toolbar into dedicated tile for customization.
|
|
208
|
+
[rnix]
|
|
209
|
+
|
|
210
|
+
- Reduce included files and plugins of jquery fileupload to required ones.
|
|
211
|
+
[rnix]
|
|
212
|
+
|
|
213
|
+
- Update jquery fileupload to version 10.32.0.
|
|
214
|
+
[rnix]
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
0.5 (2021-11-08)
|
|
218
|
+
----------------
|
|
219
|
+
|
|
220
|
+
- Rename deprecated ``allow_non_node_childs`` to ``allow_non_node_children``
|
|
221
|
+
in tests and documentation.
|
|
222
|
+
[rnix]
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
0.4 (2020-05-30)
|
|
226
|
+
----------------
|
|
227
|
+
|
|
228
|
+
- Initial pypi release
|
|
229
|
+
[rnix]
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
0.3
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
- Python 3 compatibility.
|
|
236
|
+
[rnix]
|
|
237
|
+
|
|
238
|
+
- Convert doctests to unittests.
|
|
239
|
+
[rnix]
|
|
240
|
+
|
|
241
|
+
- Use ``cone.app.main_hook`` decorator.
|
|
242
|
+
[rnix]
|
|
243
|
+
|
|
244
|
+
- Move resource registration to main hook.
|
|
245
|
+
[rnix]
|
|
246
|
+
|
|
247
|
+
- Upgrade to ``cone.app`` 1.0b1.
|
|
248
|
+
[rnix]
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
0.2
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
- Code organization.
|
|
255
|
+
[rnix]
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
0.1
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
- Make it work
|
|
262
|
+
[rnix]
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
License
|
|
266
|
+
=======
|
|
267
|
+
|
|
268
|
+
Copyright (c) 2013-2021, BlueDynamics Alliance, Austria
|
|
269
|
+
Copyright (c) 2021-2022, Cone Contributors
|
|
270
|
+
All rights reserved.
|
|
271
|
+
|
|
272
|
+
Redistribution and use in source and binary forms, with or without
|
|
273
|
+
modification, are permitted provided that the following conditions are met:
|
|
274
|
+
|
|
275
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
276
|
+
list of conditions and the following disclaimer.
|
|
277
|
+
|
|
278
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
279
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
280
|
+
other materials provided with the distribution.
|
|
281
|
+
|
|
282
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
283
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
284
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
285
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
286
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
287
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
288
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
289
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
290
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
291
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -61,8 +61,9 @@ So first we need to provide a model.
|
|
|
61
61
|
|
|
62
62
|
class File(BaseNode):
|
|
63
63
|
__acl__ = ACL
|
|
64
|
+
|
|
64
65
|
# allow setting any value types
|
|
65
|
-
|
|
66
|
+
child_constraints = None
|
|
66
67
|
|
|
67
68
|
Now we need to provide a concrete ``FileUploadHandle`` implementation for
|
|
68
69
|
our model.
|
|
@@ -9,7 +9,7 @@ def read_file(name):
|
|
|
9
9
|
return f.read()
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
version = '0.
|
|
12
|
+
version = '0.8'
|
|
13
13
|
shortdesc = 'jQuery File Upload integration for cone.app'
|
|
14
14
|
longdesc = '\n\n'.join([read_file(name) for name in [
|
|
15
15
|
'README.rst',
|
|
@@ -47,7 +47,7 @@ setup(
|
|
|
47
47
|
zip_safe=False,
|
|
48
48
|
install_requires=[
|
|
49
49
|
'setuptools',
|
|
50
|
-
'cone.app>=1.0.3',
|
|
50
|
+
'cone.app>=1.0.3,<1.1.0',
|
|
51
51
|
],
|
|
52
52
|
extras_require=dict(test=['zope.testrunner']),
|
|
53
53
|
tests_require=['zope.testrunner'],
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cone.fileupload
|
|
3
|
+
Version: 0.8
|
|
4
|
+
Summary: jQuery File Upload integration for cone.app
|
|
5
|
+
Home-page: http://github.com/conestack/cone.fileuplaod
|
|
6
|
+
Author: Cone Contributors
|
|
7
|
+
Author-email: dev@conestack.org
|
|
8
|
+
License: Simplified BSD
|
|
9
|
+
Keywords: node pyramid cone web
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
13
|
+
License-File: LICENSE.rst
|
|
14
|
+
Requires-Dist: setuptools
|
|
15
|
+
Requires-Dist: cone.app<1.1.0,>=1.0.3
|
|
16
|
+
Provides-Extra: test
|
|
17
|
+
Requires-Dist: zope.testrunner; extra == "test"
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: author-email
|
|
20
|
+
Dynamic: classifier
|
|
21
|
+
Dynamic: description
|
|
22
|
+
Dynamic: home-page
|
|
23
|
+
Dynamic: keywords
|
|
24
|
+
Dynamic: license
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: provides-extra
|
|
27
|
+
Dynamic: requires-dist
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+
.. image:: https://img.shields.io/pypi/v/cone.fileupload.svg
|
|
31
|
+
:target: https://pypi.python.org/pypi/cone.fileupload
|
|
32
|
+
:alt: Latest PyPI version
|
|
33
|
+
|
|
34
|
+
.. image:: https://img.shields.io/pypi/dm/cone.fileupload.svg
|
|
35
|
+
:target: https://pypi.python.org/pypi/cone.fileupload
|
|
36
|
+
:alt: Number of PyPI downloads
|
|
37
|
+
|
|
38
|
+
.. image:: https://travis-ci.org/bluedynamics/cone.fileupload.svg?branch=master
|
|
39
|
+
:target: https://travis-ci.org/bluedynamics/cone.fileupload
|
|
40
|
+
|
|
41
|
+
.. image:: https://coveralls.io/repos/github/bluedynamics/cone.fileupload/badge.svg?branch=master
|
|
42
|
+
:target: https://coveralls.io/github/bluedynamics/cone.fileupload?branch=master
|
|
43
|
+
|
|
44
|
+
This package integrates
|
|
45
|
+
`jQueryFileUpload <https://github.com/blueimp/jQuery-File-Upload>`_ in cone.
|
|
46
|
+
|
|
47
|
+
Currently, version 10.32.0 is included.
|
|
48
|
+
|
|
49
|
+
Included files of jQuery File Upload:
|
|
50
|
+
|
|
51
|
+
* jquery.iframe-transport.js
|
|
52
|
+
* jquery.fileupload.js
|
|
53
|
+
* jquery.fileupload-process.js
|
|
54
|
+
* jquery.fileupload-ui.js
|
|
55
|
+
* jquery.fileupload-validate.js
|
|
56
|
+
|
|
57
|
+
Additionally, v3.20.0 of
|
|
58
|
+
`Javascript-Templates <https://github.com/blueimp/JavaScript-Templates>`_
|
|
59
|
+
is included.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Usage
|
|
63
|
+
-----
|
|
64
|
+
|
|
65
|
+
Since ``cone.app`` not knows about the underlying data, ``cone.fileupload``
|
|
66
|
+
only provides an abstract server implementation.
|
|
67
|
+
|
|
68
|
+
So first we need to provide a model.
|
|
69
|
+
|
|
70
|
+
.. code-block:: python
|
|
71
|
+
|
|
72
|
+
from cone.app.model import BaseNode
|
|
73
|
+
from pyramid.security import ALL_PERMISSIONS
|
|
74
|
+
from pyramid.security import Allow
|
|
75
|
+
from pyramid.security import Deny
|
|
76
|
+
from pyramid.security import Everyone
|
|
77
|
+
|
|
78
|
+
ACL = [
|
|
79
|
+
(Allow, 'role:manager', ['add', 'delete']),
|
|
80
|
+
(Allow, Everyone, ['login']),
|
|
81
|
+
(Deny, Everyone, ALL_PERMISSIONS),
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
class Container(BaseNode):
|
|
85
|
+
__acl__ = ACL
|
|
86
|
+
|
|
87
|
+
def __call__(self):
|
|
88
|
+
"""Persistence happens here.
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
class File(BaseNode):
|
|
92
|
+
__acl__ = ACL
|
|
93
|
+
|
|
94
|
+
# allow setting any value types
|
|
95
|
+
child_constraints = None
|
|
96
|
+
|
|
97
|
+
Now we need to provide a concrete ``FileUploadHandle`` implementation for
|
|
98
|
+
our model.
|
|
99
|
+
|
|
100
|
+
.. code-block:: python
|
|
101
|
+
|
|
102
|
+
from cone.fileupload.browser.fileupload import FileUploadHandle
|
|
103
|
+
from pyramid.view import view_config
|
|
104
|
+
|
|
105
|
+
@view_config(
|
|
106
|
+
name='fileupload_handle',
|
|
107
|
+
context=Container, # <- here the view gets bound to our model
|
|
108
|
+
accept='application/json',
|
|
109
|
+
renderer='json',
|
|
110
|
+
permission='add')
|
|
111
|
+
class ContainerFileUploadHandle(FileUploadHandle):
|
|
112
|
+
|
|
113
|
+
def create_file(self, stream, filename, mimetype):
|
|
114
|
+
# this function gets called for persisting uploaded files
|
|
115
|
+
file = self.model[filename] = File()
|
|
116
|
+
file['body'] = stream.read()
|
|
117
|
+
return {
|
|
118
|
+
'name': filename,
|
|
119
|
+
'size': len(file['body']),
|
|
120
|
+
'view_url': '/{0}'.format(file.name),
|
|
121
|
+
'download_url': '/{0}/download'.format(file.name),
|
|
122
|
+
'delete_url': '/{0}/filedelete_handle'.format(file.name),
|
|
123
|
+
'delete_type': 'GET',
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
def read_existing(self):
|
|
127
|
+
# this function gets called for initial reading of existing files
|
|
128
|
+
files = list()
|
|
129
|
+
for node in self.model.values():
|
|
130
|
+
files.append({
|
|
131
|
+
'name': node.name,
|
|
132
|
+
'size': len(node['body']),
|
|
133
|
+
'view_url': '/{0}'.format(node.name),
|
|
134
|
+
'download_url': '/{0}/download'.format(node.name),
|
|
135
|
+
'delete_url': '/{0}/filedelete_handle'.format(node.name),
|
|
136
|
+
'delete_type': 'GET',
|
|
137
|
+
})
|
|
138
|
+
return files
|
|
139
|
+
|
|
140
|
+
Optionally we might want to provide a custom fileupload tile for our model.
|
|
141
|
+
|
|
142
|
+
.. code-block:: python
|
|
143
|
+
|
|
144
|
+
from cone.tile import tile
|
|
145
|
+
from cone.fileupload.browser.fileupload import FileUploadTile
|
|
146
|
+
|
|
147
|
+
@tile(
|
|
148
|
+
name='fileupload',
|
|
149
|
+
path='cone.fileupload:browser/fileupload.pt',
|
|
150
|
+
interface=Container,
|
|
151
|
+
permission='add')
|
|
152
|
+
class ContainerFileUploadTile(FileUploadTile):
|
|
153
|
+
accept_file_types = r'/(\.|\/)(gif|jpg)$/i'
|
|
154
|
+
|
|
155
|
+
The file upload actions are either rendered as dedicated tile by name
|
|
156
|
+
``fileupload_toolbar`` or integrated into the context menu. If it's desired to
|
|
157
|
+
display the action in the context menu, ``fileupload_contextmenu_actions``
|
|
158
|
+
flag must be set on model ``properties``.
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
Contributors
|
|
162
|
+
============
|
|
163
|
+
|
|
164
|
+
- Robert Niederreiter
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
Changes
|
|
168
|
+
=======
|
|
169
|
+
|
|
170
|
+
0.8 (2025-10-25)
|
|
171
|
+
----------------
|
|
172
|
+
|
|
173
|
+
- Pin upper versions of dependencies.
|
|
174
|
+
[rnix]
|
|
175
|
+
|
|
176
|
+
- Replace deprecated use of ``allow_non_node_children`` by ``child_constraints``.
|
|
177
|
+
[rnix]
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
0.7 (2022-01-19)
|
|
181
|
+
----------------
|
|
182
|
+
|
|
183
|
+
- Modernize JavaScript setup.
|
|
184
|
+
|
|
185
|
+
- Add ``i18n_messages_src``, ``upload_template_src`` and
|
|
186
|
+
``download_template_src`` attributes to ``FileUploadTile``.
|
|
187
|
+
|
|
188
|
+
- Add optional ``download_url`` to file data dict.
|
|
189
|
+
|
|
190
|
+
- Remove ``thumbnailUrl`` from file data dict.
|
|
191
|
+
|
|
192
|
+
**Breaking Changes**
|
|
193
|
+
|
|
194
|
+
- Rename ``url`` to ``view_url`` in file data dict.
|
|
195
|
+
|
|
196
|
+
- Rename ``deleteUrl`` to ``delete_url`` in file data dict.
|
|
197
|
+
|
|
198
|
+
- Rename ``deleteType`` to ``delete_type`` in file data dict.
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
0.6 (2021-11-21)
|
|
202
|
+
----------------
|
|
203
|
+
|
|
204
|
+
- Fileupload actions optionally work from contextmenu.
|
|
205
|
+
[rnix]
|
|
206
|
+
|
|
207
|
+
- Move button toolbar into dedicated tile for customization.
|
|
208
|
+
[rnix]
|
|
209
|
+
|
|
210
|
+
- Reduce included files and plugins of jquery fileupload to required ones.
|
|
211
|
+
[rnix]
|
|
212
|
+
|
|
213
|
+
- Update jquery fileupload to version 10.32.0.
|
|
214
|
+
[rnix]
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
0.5 (2021-11-08)
|
|
218
|
+
----------------
|
|
219
|
+
|
|
220
|
+
- Rename deprecated ``allow_non_node_childs`` to ``allow_non_node_children``
|
|
221
|
+
in tests and documentation.
|
|
222
|
+
[rnix]
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
0.4 (2020-05-30)
|
|
226
|
+
----------------
|
|
227
|
+
|
|
228
|
+
- Initial pypi release
|
|
229
|
+
[rnix]
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
0.3
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
- Python 3 compatibility.
|
|
236
|
+
[rnix]
|
|
237
|
+
|
|
238
|
+
- Convert doctests to unittests.
|
|
239
|
+
[rnix]
|
|
240
|
+
|
|
241
|
+
- Use ``cone.app.main_hook`` decorator.
|
|
242
|
+
[rnix]
|
|
243
|
+
|
|
244
|
+
- Move resource registration to main hook.
|
|
245
|
+
[rnix]
|
|
246
|
+
|
|
247
|
+
- Upgrade to ``cone.app`` 1.0b1.
|
|
248
|
+
[rnix]
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
0.2
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
- Code organization.
|
|
255
|
+
[rnix]
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
0.1
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
- Make it work
|
|
262
|
+
[rnix]
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
License
|
|
266
|
+
=======
|
|
267
|
+
|
|
268
|
+
Copyright (c) 2013-2021, BlueDynamics Alliance, Austria
|
|
269
|
+
Copyright (c) 2021-2022, Cone Contributors
|
|
270
|
+
All rights reserved.
|
|
271
|
+
|
|
272
|
+
Redistribution and use in source and binary forms, with or without
|
|
273
|
+
modification, are permitted provided that the following conditions are met:
|
|
274
|
+
|
|
275
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
276
|
+
list of conditions and the following disclaimer.
|
|
277
|
+
|
|
278
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
279
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
280
|
+
other materials provided with the distribution.
|
|
281
|
+
|
|
282
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
283
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
284
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
285
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
286
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
287
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
288
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
289
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
290
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
291
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
cone.fileupload-0.7/PKG-INFO
DELETED
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: cone.fileupload
|
|
3
|
-
Version: 0.7
|
|
4
|
-
Summary: jQuery File Upload integration for cone.app
|
|
5
|
-
Home-page: http://github.com/conestack/cone.fileuplaod
|
|
6
|
-
Author: Cone Contributors
|
|
7
|
-
Author-email: dev@conestack.org
|
|
8
|
-
License: Simplified BSD
|
|
9
|
-
Description: .. image:: https://img.shields.io/pypi/v/cone.fileupload.svg
|
|
10
|
-
:target: https://pypi.python.org/pypi/cone.fileupload
|
|
11
|
-
:alt: Latest PyPI version
|
|
12
|
-
|
|
13
|
-
.. image:: https://img.shields.io/pypi/dm/cone.fileupload.svg
|
|
14
|
-
:target: https://pypi.python.org/pypi/cone.fileupload
|
|
15
|
-
:alt: Number of PyPI downloads
|
|
16
|
-
|
|
17
|
-
.. image:: https://travis-ci.org/bluedynamics/cone.fileupload.svg?branch=master
|
|
18
|
-
:target: https://travis-ci.org/bluedynamics/cone.fileupload
|
|
19
|
-
|
|
20
|
-
.. image:: https://coveralls.io/repos/github/bluedynamics/cone.fileupload/badge.svg?branch=master
|
|
21
|
-
:target: https://coveralls.io/github/bluedynamics/cone.fileupload?branch=master
|
|
22
|
-
|
|
23
|
-
This package integrates
|
|
24
|
-
`jQueryFileUpload <https://github.com/blueimp/jQuery-File-Upload>`_ in cone.
|
|
25
|
-
|
|
26
|
-
Currently, version 10.32.0 is included.
|
|
27
|
-
|
|
28
|
-
Included files of jQuery File Upload:
|
|
29
|
-
|
|
30
|
-
* jquery.iframe-transport.js
|
|
31
|
-
* jquery.fileupload.js
|
|
32
|
-
* jquery.fileupload-process.js
|
|
33
|
-
* jquery.fileupload-ui.js
|
|
34
|
-
* jquery.fileupload-validate.js
|
|
35
|
-
|
|
36
|
-
Additionally, v3.20.0 of
|
|
37
|
-
`Javascript-Templates <https://github.com/blueimp/JavaScript-Templates>`_
|
|
38
|
-
is included.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Usage
|
|
42
|
-
-----
|
|
43
|
-
|
|
44
|
-
Since ``cone.app`` not knows about the underlying data, ``cone.fileupload``
|
|
45
|
-
only provides an abstract server implementation.
|
|
46
|
-
|
|
47
|
-
So first we need to provide a model.
|
|
48
|
-
|
|
49
|
-
.. code-block:: python
|
|
50
|
-
|
|
51
|
-
from cone.app.model import BaseNode
|
|
52
|
-
from pyramid.security import ALL_PERMISSIONS
|
|
53
|
-
from pyramid.security import Allow
|
|
54
|
-
from pyramid.security import Deny
|
|
55
|
-
from pyramid.security import Everyone
|
|
56
|
-
|
|
57
|
-
ACL = [
|
|
58
|
-
(Allow, 'role:manager', ['add', 'delete']),
|
|
59
|
-
(Allow, Everyone, ['login']),
|
|
60
|
-
(Deny, Everyone, ALL_PERMISSIONS),
|
|
61
|
-
]
|
|
62
|
-
|
|
63
|
-
class Container(BaseNode):
|
|
64
|
-
__acl__ = ACL
|
|
65
|
-
|
|
66
|
-
def __call__(self):
|
|
67
|
-
"""Persistence happens here.
|
|
68
|
-
"""
|
|
69
|
-
|
|
70
|
-
class File(BaseNode):
|
|
71
|
-
__acl__ = ACL
|
|
72
|
-
# allow setting any value types
|
|
73
|
-
allow_non_node_children = True
|
|
74
|
-
|
|
75
|
-
Now we need to provide a concrete ``FileUploadHandle`` implementation for
|
|
76
|
-
our model.
|
|
77
|
-
|
|
78
|
-
.. code-block:: python
|
|
79
|
-
|
|
80
|
-
from cone.fileupload.browser.fileupload import FileUploadHandle
|
|
81
|
-
from pyramid.view import view_config
|
|
82
|
-
|
|
83
|
-
@view_config(
|
|
84
|
-
name='fileupload_handle',
|
|
85
|
-
context=Container, # <- here the view gets bound to our model
|
|
86
|
-
accept='application/json',
|
|
87
|
-
renderer='json',
|
|
88
|
-
permission='add')
|
|
89
|
-
class ContainerFileUploadHandle(FileUploadHandle):
|
|
90
|
-
|
|
91
|
-
def create_file(self, stream, filename, mimetype):
|
|
92
|
-
# this function gets called for persisting uploaded files
|
|
93
|
-
file = self.model[filename] = File()
|
|
94
|
-
file['body'] = stream.read()
|
|
95
|
-
return {
|
|
96
|
-
'name': filename,
|
|
97
|
-
'size': len(file['body']),
|
|
98
|
-
'view_url': '/{0}'.format(file.name),
|
|
99
|
-
'download_url': '/{0}/download'.format(file.name),
|
|
100
|
-
'delete_url': '/{0}/filedelete_handle'.format(file.name),
|
|
101
|
-
'delete_type': 'GET',
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
def read_existing(self):
|
|
105
|
-
# this function gets called for initial reading of existing files
|
|
106
|
-
files = list()
|
|
107
|
-
for node in self.model.values():
|
|
108
|
-
files.append({
|
|
109
|
-
'name': node.name,
|
|
110
|
-
'size': len(node['body']),
|
|
111
|
-
'view_url': '/{0}'.format(node.name),
|
|
112
|
-
'download_url': '/{0}/download'.format(node.name),
|
|
113
|
-
'delete_url': '/{0}/filedelete_handle'.format(node.name),
|
|
114
|
-
'delete_type': 'GET',
|
|
115
|
-
})
|
|
116
|
-
return files
|
|
117
|
-
|
|
118
|
-
Optionally we might want to provide a custom fileupload tile for our model.
|
|
119
|
-
|
|
120
|
-
.. code-block:: python
|
|
121
|
-
|
|
122
|
-
from cone.tile import tile
|
|
123
|
-
from cone.fileupload.browser.fileupload import FileUploadTile
|
|
124
|
-
|
|
125
|
-
@tile(
|
|
126
|
-
name='fileupload',
|
|
127
|
-
path='cone.fileupload:browser/fileupload.pt',
|
|
128
|
-
interface=Container,
|
|
129
|
-
permission='add')
|
|
130
|
-
class ContainerFileUploadTile(FileUploadTile):
|
|
131
|
-
accept_file_types = r'/(\.|\/)(gif|jpg)$/i'
|
|
132
|
-
|
|
133
|
-
The file upload actions are either rendered as dedicated tile by name
|
|
134
|
-
``fileupload_toolbar`` or integrated into the context menu. If it's desired to
|
|
135
|
-
display the action in the context menu, ``fileupload_contextmenu_actions``
|
|
136
|
-
flag must be set on model ``properties``.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
Contributors
|
|
140
|
-
============
|
|
141
|
-
|
|
142
|
-
- Robert Niederreiter
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Changes
|
|
146
|
-
=======
|
|
147
|
-
|
|
148
|
-
0.7 (2022-01-19)
|
|
149
|
-
----------------
|
|
150
|
-
|
|
151
|
-
- Modernize JavaScript setup.
|
|
152
|
-
|
|
153
|
-
- Add ``i18n_messages_src``, ``upload_template_src`` and
|
|
154
|
-
``download_template_src`` attributes to ``FileUploadTile``.
|
|
155
|
-
|
|
156
|
-
- Add optional ``download_url`` to file data dict.
|
|
157
|
-
|
|
158
|
-
- Remove ``thumbnailUrl`` from file data dict.
|
|
159
|
-
|
|
160
|
-
**Breaking Changes**
|
|
161
|
-
|
|
162
|
-
- Rename ``url`` to ``view_url`` in file data dict.
|
|
163
|
-
|
|
164
|
-
- Rename ``deleteUrl`` to ``delete_url`` in file data dict.
|
|
165
|
-
|
|
166
|
-
- Rename ``deleteType`` to ``delete_type`` in file data dict.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
0.6 (2021-11-21)
|
|
170
|
-
----------------
|
|
171
|
-
|
|
172
|
-
- Fileupload actions optionally work from contextmenu.
|
|
173
|
-
[rnix]
|
|
174
|
-
|
|
175
|
-
- Move button toolbar into dedicated tile for customization.
|
|
176
|
-
[rnix]
|
|
177
|
-
|
|
178
|
-
- Reduce included files and plugins of jquery fileupload to required ones.
|
|
179
|
-
[rnix]
|
|
180
|
-
|
|
181
|
-
- Update jquery fileupload to version 10.32.0.
|
|
182
|
-
[rnix]
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
0.5 (2021-11-08)
|
|
186
|
-
----------------
|
|
187
|
-
|
|
188
|
-
- Rename deprecated ``allow_non_node_childs`` to ``allow_non_node_children``
|
|
189
|
-
in tests and documentation.
|
|
190
|
-
[rnix]
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
0.4 (2020-05-30)
|
|
194
|
-
----------------
|
|
195
|
-
|
|
196
|
-
- Initial pypi release
|
|
197
|
-
[rnix]
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
0.3
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
- Python 3 compatibility.
|
|
204
|
-
[rnix]
|
|
205
|
-
|
|
206
|
-
- Convert doctests to unittests.
|
|
207
|
-
[rnix]
|
|
208
|
-
|
|
209
|
-
- Use ``cone.app.main_hook`` decorator.
|
|
210
|
-
[rnix]
|
|
211
|
-
|
|
212
|
-
- Move resource registration to main hook.
|
|
213
|
-
[rnix]
|
|
214
|
-
|
|
215
|
-
- Upgrade to ``cone.app`` 1.0b1.
|
|
216
|
-
[rnix]
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
0.2
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
- Code organization.
|
|
223
|
-
[rnix]
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
0.1
|
|
227
|
-
---
|
|
228
|
-
|
|
229
|
-
- Make it work
|
|
230
|
-
[rnix]
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
License
|
|
234
|
-
=======
|
|
235
|
-
|
|
236
|
-
Copyright (c) 2013-2021, BlueDynamics Alliance, Austria
|
|
237
|
-
Copyright (c) 2021, Cone Contributors
|
|
238
|
-
All rights reserved.
|
|
239
|
-
|
|
240
|
-
Redistribution and use in source and binary forms, with or without
|
|
241
|
-
modification, are permitted provided that the following conditions are met:
|
|
242
|
-
|
|
243
|
-
* Redistributions of source code must retain the above copyright notice, this
|
|
244
|
-
list of conditions and the following disclaimer.
|
|
245
|
-
|
|
246
|
-
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
247
|
-
list of conditions and the following disclaimer in the documentation and/or
|
|
248
|
-
other materials provided with the distribution.
|
|
249
|
-
|
|
250
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
251
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
252
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
253
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
254
|
-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
255
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
256
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
257
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
258
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
259
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
260
|
-
|
|
261
|
-
Keywords: node pyramid cone web
|
|
262
|
-
Platform: UNKNOWN
|
|
263
|
-
Classifier: Environment :: Web Environment
|
|
264
|
-
Classifier: Programming Language :: Python
|
|
265
|
-
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
266
|
-
Provides-Extra: test
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: cone.fileupload
|
|
3
|
-
Version: 0.7
|
|
4
|
-
Summary: jQuery File Upload integration for cone.app
|
|
5
|
-
Home-page: http://github.com/conestack/cone.fileuplaod
|
|
6
|
-
Author: Cone Contributors
|
|
7
|
-
Author-email: dev@conestack.org
|
|
8
|
-
License: Simplified BSD
|
|
9
|
-
Description: .. image:: https://img.shields.io/pypi/v/cone.fileupload.svg
|
|
10
|
-
:target: https://pypi.python.org/pypi/cone.fileupload
|
|
11
|
-
:alt: Latest PyPI version
|
|
12
|
-
|
|
13
|
-
.. image:: https://img.shields.io/pypi/dm/cone.fileupload.svg
|
|
14
|
-
:target: https://pypi.python.org/pypi/cone.fileupload
|
|
15
|
-
:alt: Number of PyPI downloads
|
|
16
|
-
|
|
17
|
-
.. image:: https://travis-ci.org/bluedynamics/cone.fileupload.svg?branch=master
|
|
18
|
-
:target: https://travis-ci.org/bluedynamics/cone.fileupload
|
|
19
|
-
|
|
20
|
-
.. image:: https://coveralls.io/repos/github/bluedynamics/cone.fileupload/badge.svg?branch=master
|
|
21
|
-
:target: https://coveralls.io/github/bluedynamics/cone.fileupload?branch=master
|
|
22
|
-
|
|
23
|
-
This package integrates
|
|
24
|
-
`jQueryFileUpload <https://github.com/blueimp/jQuery-File-Upload>`_ in cone.
|
|
25
|
-
|
|
26
|
-
Currently, version 10.32.0 is included.
|
|
27
|
-
|
|
28
|
-
Included files of jQuery File Upload:
|
|
29
|
-
|
|
30
|
-
* jquery.iframe-transport.js
|
|
31
|
-
* jquery.fileupload.js
|
|
32
|
-
* jquery.fileupload-process.js
|
|
33
|
-
* jquery.fileupload-ui.js
|
|
34
|
-
* jquery.fileupload-validate.js
|
|
35
|
-
|
|
36
|
-
Additionally, v3.20.0 of
|
|
37
|
-
`Javascript-Templates <https://github.com/blueimp/JavaScript-Templates>`_
|
|
38
|
-
is included.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Usage
|
|
42
|
-
-----
|
|
43
|
-
|
|
44
|
-
Since ``cone.app`` not knows about the underlying data, ``cone.fileupload``
|
|
45
|
-
only provides an abstract server implementation.
|
|
46
|
-
|
|
47
|
-
So first we need to provide a model.
|
|
48
|
-
|
|
49
|
-
.. code-block:: python
|
|
50
|
-
|
|
51
|
-
from cone.app.model import BaseNode
|
|
52
|
-
from pyramid.security import ALL_PERMISSIONS
|
|
53
|
-
from pyramid.security import Allow
|
|
54
|
-
from pyramid.security import Deny
|
|
55
|
-
from pyramid.security import Everyone
|
|
56
|
-
|
|
57
|
-
ACL = [
|
|
58
|
-
(Allow, 'role:manager', ['add', 'delete']),
|
|
59
|
-
(Allow, Everyone, ['login']),
|
|
60
|
-
(Deny, Everyone, ALL_PERMISSIONS),
|
|
61
|
-
]
|
|
62
|
-
|
|
63
|
-
class Container(BaseNode):
|
|
64
|
-
__acl__ = ACL
|
|
65
|
-
|
|
66
|
-
def __call__(self):
|
|
67
|
-
"""Persistence happens here.
|
|
68
|
-
"""
|
|
69
|
-
|
|
70
|
-
class File(BaseNode):
|
|
71
|
-
__acl__ = ACL
|
|
72
|
-
# allow setting any value types
|
|
73
|
-
allow_non_node_children = True
|
|
74
|
-
|
|
75
|
-
Now we need to provide a concrete ``FileUploadHandle`` implementation for
|
|
76
|
-
our model.
|
|
77
|
-
|
|
78
|
-
.. code-block:: python
|
|
79
|
-
|
|
80
|
-
from cone.fileupload.browser.fileupload import FileUploadHandle
|
|
81
|
-
from pyramid.view import view_config
|
|
82
|
-
|
|
83
|
-
@view_config(
|
|
84
|
-
name='fileupload_handle',
|
|
85
|
-
context=Container, # <- here the view gets bound to our model
|
|
86
|
-
accept='application/json',
|
|
87
|
-
renderer='json',
|
|
88
|
-
permission='add')
|
|
89
|
-
class ContainerFileUploadHandle(FileUploadHandle):
|
|
90
|
-
|
|
91
|
-
def create_file(self, stream, filename, mimetype):
|
|
92
|
-
# this function gets called for persisting uploaded files
|
|
93
|
-
file = self.model[filename] = File()
|
|
94
|
-
file['body'] = stream.read()
|
|
95
|
-
return {
|
|
96
|
-
'name': filename,
|
|
97
|
-
'size': len(file['body']),
|
|
98
|
-
'view_url': '/{0}'.format(file.name),
|
|
99
|
-
'download_url': '/{0}/download'.format(file.name),
|
|
100
|
-
'delete_url': '/{0}/filedelete_handle'.format(file.name),
|
|
101
|
-
'delete_type': 'GET',
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
def read_existing(self):
|
|
105
|
-
# this function gets called for initial reading of existing files
|
|
106
|
-
files = list()
|
|
107
|
-
for node in self.model.values():
|
|
108
|
-
files.append({
|
|
109
|
-
'name': node.name,
|
|
110
|
-
'size': len(node['body']),
|
|
111
|
-
'view_url': '/{0}'.format(node.name),
|
|
112
|
-
'download_url': '/{0}/download'.format(node.name),
|
|
113
|
-
'delete_url': '/{0}/filedelete_handle'.format(node.name),
|
|
114
|
-
'delete_type': 'GET',
|
|
115
|
-
})
|
|
116
|
-
return files
|
|
117
|
-
|
|
118
|
-
Optionally we might want to provide a custom fileupload tile for our model.
|
|
119
|
-
|
|
120
|
-
.. code-block:: python
|
|
121
|
-
|
|
122
|
-
from cone.tile import tile
|
|
123
|
-
from cone.fileupload.browser.fileupload import FileUploadTile
|
|
124
|
-
|
|
125
|
-
@tile(
|
|
126
|
-
name='fileupload',
|
|
127
|
-
path='cone.fileupload:browser/fileupload.pt',
|
|
128
|
-
interface=Container,
|
|
129
|
-
permission='add')
|
|
130
|
-
class ContainerFileUploadTile(FileUploadTile):
|
|
131
|
-
accept_file_types = r'/(\.|\/)(gif|jpg)$/i'
|
|
132
|
-
|
|
133
|
-
The file upload actions are either rendered as dedicated tile by name
|
|
134
|
-
``fileupload_toolbar`` or integrated into the context menu. If it's desired to
|
|
135
|
-
display the action in the context menu, ``fileupload_contextmenu_actions``
|
|
136
|
-
flag must be set on model ``properties``.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
Contributors
|
|
140
|
-
============
|
|
141
|
-
|
|
142
|
-
- Robert Niederreiter
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Changes
|
|
146
|
-
=======
|
|
147
|
-
|
|
148
|
-
0.7 (2022-01-19)
|
|
149
|
-
----------------
|
|
150
|
-
|
|
151
|
-
- Modernize JavaScript setup.
|
|
152
|
-
|
|
153
|
-
- Add ``i18n_messages_src``, ``upload_template_src`` and
|
|
154
|
-
``download_template_src`` attributes to ``FileUploadTile``.
|
|
155
|
-
|
|
156
|
-
- Add optional ``download_url`` to file data dict.
|
|
157
|
-
|
|
158
|
-
- Remove ``thumbnailUrl`` from file data dict.
|
|
159
|
-
|
|
160
|
-
**Breaking Changes**
|
|
161
|
-
|
|
162
|
-
- Rename ``url`` to ``view_url`` in file data dict.
|
|
163
|
-
|
|
164
|
-
- Rename ``deleteUrl`` to ``delete_url`` in file data dict.
|
|
165
|
-
|
|
166
|
-
- Rename ``deleteType`` to ``delete_type`` in file data dict.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
0.6 (2021-11-21)
|
|
170
|
-
----------------
|
|
171
|
-
|
|
172
|
-
- Fileupload actions optionally work from contextmenu.
|
|
173
|
-
[rnix]
|
|
174
|
-
|
|
175
|
-
- Move button toolbar into dedicated tile for customization.
|
|
176
|
-
[rnix]
|
|
177
|
-
|
|
178
|
-
- Reduce included files and plugins of jquery fileupload to required ones.
|
|
179
|
-
[rnix]
|
|
180
|
-
|
|
181
|
-
- Update jquery fileupload to version 10.32.0.
|
|
182
|
-
[rnix]
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
0.5 (2021-11-08)
|
|
186
|
-
----------------
|
|
187
|
-
|
|
188
|
-
- Rename deprecated ``allow_non_node_childs`` to ``allow_non_node_children``
|
|
189
|
-
in tests and documentation.
|
|
190
|
-
[rnix]
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
0.4 (2020-05-30)
|
|
194
|
-
----------------
|
|
195
|
-
|
|
196
|
-
- Initial pypi release
|
|
197
|
-
[rnix]
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
0.3
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
- Python 3 compatibility.
|
|
204
|
-
[rnix]
|
|
205
|
-
|
|
206
|
-
- Convert doctests to unittests.
|
|
207
|
-
[rnix]
|
|
208
|
-
|
|
209
|
-
- Use ``cone.app.main_hook`` decorator.
|
|
210
|
-
[rnix]
|
|
211
|
-
|
|
212
|
-
- Move resource registration to main hook.
|
|
213
|
-
[rnix]
|
|
214
|
-
|
|
215
|
-
- Upgrade to ``cone.app`` 1.0b1.
|
|
216
|
-
[rnix]
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
0.2
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
- Code organization.
|
|
223
|
-
[rnix]
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
0.1
|
|
227
|
-
---
|
|
228
|
-
|
|
229
|
-
- Make it work
|
|
230
|
-
[rnix]
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
License
|
|
234
|
-
=======
|
|
235
|
-
|
|
236
|
-
Copyright (c) 2013-2021, BlueDynamics Alliance, Austria
|
|
237
|
-
Copyright (c) 2021, Cone Contributors
|
|
238
|
-
All rights reserved.
|
|
239
|
-
|
|
240
|
-
Redistribution and use in source and binary forms, with or without
|
|
241
|
-
modification, are permitted provided that the following conditions are met:
|
|
242
|
-
|
|
243
|
-
* Redistributions of source code must retain the above copyright notice, this
|
|
244
|
-
list of conditions and the following disclaimer.
|
|
245
|
-
|
|
246
|
-
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
247
|
-
list of conditions and the following disclaimer in the documentation and/or
|
|
248
|
-
other materials provided with the distribution.
|
|
249
|
-
|
|
250
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
251
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
252
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
253
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
254
|
-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
255
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
256
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
257
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
258
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
259
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
260
|
-
|
|
261
|
-
Keywords: node pyramid cone web
|
|
262
|
-
Platform: UNKNOWN
|
|
263
|
-
Classifier: Environment :: Web Environment
|
|
264
|
-
Classifier: Programming Language :: Python
|
|
265
|
-
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
266
|
-
Provides-Extra: test
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload.css
RENAMED
|
File without changes
|
{cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload.js
RENAMED
|
File without changes
|
{cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone/fileupload/browser/static/fileupload.min.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone.fileupload.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{cone.fileupload-0.7 → cone_fileupload-0.8}/src/cone.fileupload.egg-info/namespace_packages.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|