Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
4773fac2
Commit
4773fac2
authored
Jun 26, 2020
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Components: Migrate BigFile Document from filesystem.
parent
9eeb4478
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
155 additions
and
22 deletions
+155
-22
bt5/erp5_big_file/DocumentTemplateItem/portal_components/document.erp5.BigFile.py
...ntTemplateItem/portal_components/document.erp5.BigFile.py
+21
-21
bt5/erp5_big_file/DocumentTemplateItem/portal_components/document.erp5.BigFile.xml
...tTemplateItem/portal_components/document.erp5.BigFile.xml
+131
-0
bt5/erp5_big_file/bt/template_document_id_list
bt5/erp5_big_file/bt/template_document_id_list
+1
-0
bt5/erp5_video/bt/dependency_list
bt5/erp5_video/bt/dependency_list
+2
-1
No files found.
product/ERP5/Document/
BigFile.py
→
bt5/erp5_big_file/DocumentTemplateItem/portal_components/document.erp5.
BigFile.py
View file @
4773fac2
...
@@ -88,7 +88,7 @@ class BigFile(File):
...
@@ -88,7 +88,7 @@ class BigFile(File):
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getData'
)
'getData'
)
def
getData
(
self
):
def
getData
(
self
,
default
=
None
):
"""Read the full btree
"""Read the full btree
"""
"""
btree
=
self
.
_baseGetData
()
btree
=
self
.
_baseGetData
()
...
@@ -103,7 +103,7 @@ class BigFile(File):
...
@@ -103,7 +103,7 @@ class BigFile(File):
"""
"""
self
.
_setContentMd5
(
None
)
self
.
_setContentMd5
(
None
)
def
_read_data
(
self
,
file
,
data
=
None
,
serialize
=
True
):
def
_read_data
(
self
,
file
,
data
=
None
,
serialize
=
True
):
# pylint: disable=redefined-builtin,arguments-differ
# We might need to make this value configurable. It is important to
# We might need to make this value configurable. It is important to
# consider the max quantity of object used in the cache. With a default
# consider the max quantity of object used in the cache. With a default
...
@@ -138,11 +138,11 @@ class BigFile(File):
...
@@ -138,11 +138,11 @@ class BigFile(File):
offset
=
len
(
btree
)
offset
=
len
(
btree
)
while
pos
<
end
:
while
pos
<
end
:
next
=
pos
+
n
next
_
=
pos
+
n
if
next
>
end
:
if
next
_
>
end
:
next
=
end
next
_
=
end
btree
.
write
(
read
(
next
-
pos
),
offset
+
pos
)
btree
.
write
(
read
(
next
_
-
pos
),
offset
+
pos
)
pos
=
file
.
tell
()
pos
=
file
.
tell
()
if
serialize
:
if
serialize
:
...
@@ -160,15 +160,15 @@ class BigFile(File):
...
@@ -160,15 +160,15 @@ class BigFile(File):
def
_range_request_handler
(
self
,
REQUEST
,
RESPONSE
):
def
_range_request_handler
(
self
,
REQUEST
,
RESPONSE
):
# HTTP Range header handling: return True if we've served a range
# HTTP Range header handling: return True if we've served a range
# chunk out of our data.
# chunk out of our data.
range
=
REQUEST
.
get_header
(
'Range'
,
None
)
range
_
=
REQUEST
.
get_header
(
'Range'
,
None
)
request_range
=
REQUEST
.
get_header
(
'Request-Range'
,
None
)
request_range
=
REQUEST
.
get_header
(
'Request-Range'
,
None
)
if
request_range
is
not
None
:
if
request_range
is
not
None
:
# Netscape 2 through 4 and MSIE 3 implement a draft version
# Netscape 2 through 4 and MSIE 3 implement a draft version
# Later on, we need to serve a different mime-type as well.
# Later on, we need to serve a different mime-type as well.
range
=
request_range
range
_
=
request_range
if_range
=
REQUEST
.
get_header
(
'If-Range'
,
None
)
if_range
=
REQUEST
.
get_header
(
'If-Range'
,
None
)
if
range
is
not
None
:
if
range
_
is
not
None
:
ranges
=
HTTPRangeSupport
.
parseRange
(
range
)
ranges
=
HTTPRangeSupport
.
parseRange
(
range
_
)
data
=
self
.
_baseGetData
()
data
=
self
.
_baseGetData
()
...
@@ -186,7 +186,7 @@ class BigFile(File):
...
@@ -186,7 +186,7 @@ class BigFile(File):
# Date
# Date
date
=
if_range
.
split
(
';'
)[
0
]
date
=
if_range
.
split
(
';'
)[
0
]
try
:
mod_since
=
long
(
DateTime
(
date
).
timeTime
())
try
:
mod_since
=
long
(
DateTime
(
date
).
timeTime
())
except
:
mod_since
=
None
except
Exception
:
mod_since
=
None
if
mod_since
is
not
None
:
if
mod_since
is
not
None
:
last_mod
=
self
.
_data_mtime
()
last_mod
=
self
.
_data_mtime
()
if
last_mod
is
None
:
if
last_mod
is
None
:
...
@@ -286,7 +286,7 @@ class BigFile(File):
...
@@ -286,7 +286,7 @@ class BigFile(File):
return
True
return
True
security
.
declareProtected
(
Permissions
.
View
,
'index_html'
)
security
.
declareProtected
(
Permissions
.
View
,
'index_html'
)
def
index_html
(
self
,
REQUEST
,
RESPONSE
,
format
=
_MARKER
,
inline
=
_MARKER
,
**
kw
):
def
index_html
(
self
,
REQUEST
,
RESPONSE
,
format
=
_MARKER
,
inline
=
_MARKER
,
**
kw
):
# pylint: disable=redefined-builtin
"""
"""
Support streaming
Support streaming
"""
"""
...
@@ -318,7 +318,7 @@ class BigFile(File):
...
@@ -318,7 +318,7 @@ class BigFile(File):
inline
=
False
inline
=
False
if
not
inline
:
if
not
inline
:
# need to return it as attachment
# need to return it as attachment
filename
=
self
.
getStandardFilename
(
format
=
format
)
filename
=
self
.
getStandardFilename
(
format
=
format
)
# pylint: disable=unused-variable
RESPONSE
.
setHeader
(
'Accept-Ranges'
,
'bytes'
)
RESPONSE
.
setHeader
(
'Accept-Ranges'
,
'bytes'
)
...
@@ -337,9 +337,9 @@ class BigFile(File):
...
@@ -337,9 +337,9 @@ class BigFile(File):
self
.
dav__init
(
REQUEST
,
RESPONSE
)
self
.
dav__init
(
REQUEST
,
RESPONSE
)
self
.
dav__simpleifhandler
(
REQUEST
,
RESPONSE
,
refresh
=
1
)
self
.
dav__simpleifhandler
(
REQUEST
,
RESPONSE
,
refresh
=
1
)
type
=
REQUEST
.
get_header
(
'content-type'
,
None
)
type
_
=
REQUEST
.
get_header
(
'content-type'
,
None
)
file
=
REQUEST
[
'BODYFILE'
]
file
_
=
REQUEST
[
'BODYFILE'
]
content_range
=
REQUEST
.
get_header
(
'Content-Range'
,
None
)
content_range
=
REQUEST
.
get_header
(
'Content-Range'
,
None
)
if
content_range
is
None
:
if
content_range
is
None
:
...
@@ -347,8 +347,8 @@ class BigFile(File):
...
@@ -347,8 +347,8 @@ class BigFile(File):
self
.
_baseSetData
(
None
)
self
.
_baseSetData
(
None
)
else
:
else
:
current_size
=
int
(
self
.
getSize
())
current_size
=
int
(
self
.
getSize
())
query_range
=
re
.
compile
(
'bytes
\
*/
\
*'
)
query_range
=
re
.
compile
(
r
'bytes \
*/
\*'
)
append_range
=
re
.
compile
(
'bytes (?P<first_byte>[0-9]+)-'
\
append_range
=
re
.
compile
(
r
'bytes (?P<first_byte>[0-9]+)-'
\
'(?P<last_byte>[0-9]+)/'
\
'(?P<last_byte>[0-9]+)/'
\
'(?P<total_content_length>[0-9]+)'
)
'(?P<total_content_length>[0-9]+)'
)
if
query_range
.
match
(
content_range
):
if
query_range
.
match
(
content_range
):
...
@@ -383,7 +383,7 @@ class BigFile(File):
...
@@ -383,7 +383,7 @@ class BigFile(File):
RESPONSE
.
setStatus
(
400
)
# Partial content
RESPONSE
.
setStatus
(
400
)
# Partial content
return
RESPONSE
return
RESPONSE
self
.
_appendData
(
file
,
content_type
=
type
)
self
.
_appendData
(
file
_
,
content_type
=
type_
)
RESPONSE
.
setStatus
(
204
)
RESPONSE
.
setStatus
(
204
)
return
RESPONSE
return
RESPONSE
...
...
bt5/erp5_big_file/DocumentTemplateItem/portal_components/document.erp5.BigFile.xml
0 → 100644
View file @
4773fac2
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Document Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
BigFile
</string>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.Document.BigFile
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
document.erp5.BigFile
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Document Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_big_file/bt/template_document_id_list
0 → 100644
View file @
4773fac2
document.erp5.BigFile
\ No newline at end of file
bt5/erp5_video/bt/dependency_list
View file @
4773fac2
erp5_dms
erp5_dms
erp5_big_file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment