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
Labels
Merge Requests
141
Merge Requests
141
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
21becf4c
Commit
21becf4c
authored
Jul 01, 2020
by
Arnaud Fontaine
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Components: Migrate Products.ERP5Type.WebDAVSupport from filesystem.
parent
48c45fbd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
156 additions
and
48 deletions
+156
-48
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.TextDocument.py
...plateItem/portal_components/document.erp5.TextDocument.py
+1
-1
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.WebDAVSupport.py
...mplateItem/portal_components/module.erp5.WebDAVSupport.py
+43
-46
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.WebDAVSupport.xml
...plateItem/portal_components/module.erp5.WebDAVSupport.xml
+110
-0
product/ERP5/bootstrap/erp5_core/bt/template_module_component_id_list
.../bootstrap/erp5_core/bt/template_module_component_id_list
+2
-1
No files found.
product/ERP5/bootstrap/erp5_core/DocumentTemplateItem/portal_components/document.erp5.TextDocument.py
View file @
21becf4c
...
@@ -33,7 +33,7 @@ from zLOG import LOG, WARNING
...
@@ -33,7 +33,7 @@ from zLOG import LOG, WARNING
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5.Document.Document
import
Document
,
ConversionError
,
_MARKER
,
DEFAULT_CONTENT_TYPE
from
Products.ERP5.Document.Document
import
Document
,
ConversionError
,
_MARKER
,
DEFAULT_CONTENT_TYPE
from
Products.ERP5.Document.File
import
File
from
Products.ERP5.Document.File
import
File
from
Products.ERP5Typ
e.WebDAVSupport
import
TextContent
from
erp5.component.modul
e.WebDAVSupport
import
TextContent
from
Products.ERP5.Document.Document
import
VALID_IMAGE_FORMAT_LIST
,
VALID_TEXT_FORMAT_LIST
from
Products.ERP5.Document.Document
import
VALID_IMAGE_FORMAT_LIST
,
VALID_TEXT_FORMAT_LIST
import
cStringIO
import
cStringIO
from
string
import
Template
from
string
import
Template
...
...
product/ERP5
Type/
WebDAVSupport.py
→
product/ERP5
/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.
WebDAVSupport.py
View file @
21becf4c
...
@@ -15,20 +15,17 @@
...
@@ -15,20 +15,17 @@
import
collections
import
collections
import
email
import
email
import
re
import
transaction
import
transaction
from
lxml
import
html
from
lxml
import
html
from
Products.ERP5Type.Utils
import
formatRFC822Headers
from
Products.ERP5Type.Utils
import
formatRFC822Headers
from
Acquisition
import
aq_
parent
,
aq_inner
,
aq_
base
from
Acquisition
import
aq_base
from
AccessControl
import
ClassSecurityInfo
,
ModuleSecurityInfo
from
AccessControl
import
ClassSecurityInfo
,
ModuleSecurityInfo
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.ERP5Type
import
Permissions
,
PropertySheet
,
Constraint
from
Products.ERP5Type
import
Permissions
from
Products.CMFCore.PortalContent
import
ResourceLockedError
from
Products.CMFCore.PortalContent
import
ResourceLockedError
from
Products.CMFCore.utils
import
getToolByName
from
zLOG
import
LOG
from
zExceptions
import
Forbidden
from
zExceptions
import
Forbidden
security
=
ModuleSecurityInfo
(
'Products.ERP5Type.WebDAVSupport'
)
security
=
ModuleSecurityInfo
(
__name__
)
class
TextContent
:
class
TextContent
:
...
@@ -82,7 +79,7 @@ class TextContent:
...
@@ -82,7 +79,7 @@ class TextContent:
headers
.
setdefault
(
'content_type'
,
content_type
)
headers
.
setdefault
(
'content_type'
,
content_type
)
headers
[
'file'
]
=
body
headers
[
'file'
]
=
body
self
.
_edit
(
**
headers
)
self
.
_edit
(
**
headers
)
except
ResourceLockedError
,
msg
:
except
ResourceLockedError
:
transaction
.
abort
()
transaction
.
abort
()
RESPONSE
.
setStatus
(
423
)
RESPONSE
.
setStatus
(
423
)
return
RESPONSE
return
RESPONSE
...
@@ -120,7 +117,7 @@ class TextContent:
...
@@ -120,7 +117,7 @@ class TextContent:
continue
continue
elif
content
is
not
None
:
elif
content
is
not
None
:
# XXX - Bad algorithm - we should use getPropertyMap directly
# XXX - Bad algorithm - we should use getPropertyMap directly
if
type
(
content
)
in
(
type
(()),
type
([]
)):
if
isinstance
(
content
,
(
list
,
tuple
)):
for
content_item
in
content
:
for
content_item
in
content
:
hdrtext
=
'%s
\
n
<meta name="%s" content="%s" />'
%
(
hdrtext
=
'%s
\
n
<meta name="%s" content="%s" />'
%
(
hdrtext
,
name
,
content_item
)
hdrtext
,
name
,
content_item
)
...
@@ -152,43 +149,43 @@ from webdav.NullResource import NullResource
...
@@ -152,43 +149,43 @@ from webdav.NullResource import NullResource
NullResource_PUT
=
NullResource
.
PUT
NullResource_PUT
=
NullResource
.
PUT
def
PUT
(
self
,
REQUEST
,
RESPONSE
):
def
PUT
(
self
,
REQUEST
,
RESPONSE
):
"""Create a new non-collection resource.
"""Create a new non-collection resource.
"""
"""
if
getattr
(
self
.
__parent__
,
'PUT_factory'
,
None
)
is
not
None
:
# BBB
if
getattr
(
self
.
__parent__
,
'PUT_factory'
,
None
)
is
not
None
:
# BBB
return
NullResource_PUT
(
self
,
REQUEST
,
RESPONSE
)
return
NullResource_PUT
(
self
,
REQUEST
,
RESPONSE
)
self
.
dav__init
(
REQUEST
,
RESPONSE
)
self
.
dav__init
(
REQUEST
,
RESPONSE
)
if
REQUEST
.
environ
[
'REQUEST_METHOD'
]
!=
'PUT'
:
if
REQUEST
.
environ
[
'REQUEST_METHOD'
]
!=
'PUT'
:
raise
Forbidden
,
'REQUEST_METHOD should be PUT.'
raise
Forbidden
,
'REQUEST_METHOD should be PUT.'
name
=
self
.
__name__
name
=
self
.
__name__
parent
=
self
.
__parent__
parent
=
self
.
__parent__
ifhdr
=
REQUEST
.
get_header
(
'If'
,
''
)
ifhdr
=
REQUEST
.
get_header
(
'If'
,
''
)
if
IWriteLock
.
providedBy
(
parent
)
and
parent
.
wl_isLocked
():
if
IWriteLock
.
providedBy
(
parent
)
and
parent
.
wl_isLocked
():
if
ifhdr
:
if
ifhdr
:
parent
.
dav__simpleifhandler
(
REQUEST
,
RESPONSE
,
col
=
1
)
parent
.
dav__simpleifhandler
(
REQUEST
,
RESPONSE
,
col
=
1
)
else
:
else
:
# There was no If header at all, and our parent is locked,
# There was no If header at all, and our parent is locked,
# so we fail here
# so we fail here
raise
Locked
raise
Locked
elif
ifhdr
:
elif
ifhdr
:
# There was an If header, but the parent is not locked
# There was an If header, but the parent is not locked
raise
PreconditionFailed
raise
PreconditionFailed
# <ERP5>
# <ERP5>
# XXX: Do we really want to force 'id'
# XXX: Do we really want to force 'id'
# when PUT is called on Contribution Tool ?
# when PUT is called on Contribution Tool ?
kw
=
{
'id'
:
name
,
'data'
:
None
,
'filename'
:
name
}
kw
=
{
'id'
:
name
,
'data'
:
None
,
'filename'
:
name
}
contribution_tool
=
parent
.
getPortalObject
().
portal_contributions
contribution_tool
=
parent
.
getPortalObject
().
portal_contributions
if
aq_base
(
contribution_tool
)
is
not
aq_base
(
parent
):
if
aq_base
(
contribution_tool
)
is
not
aq_base
(
parent
):
kw
.
update
(
container
=
parent
,
discover_metadata
=
False
)
kw
.
update
(
container
=
parent
,
discover_metadata
=
False
)
ob
=
contribution_tool
.
newContent
(
**
kw
)
ob
=
contribution_tool
.
newContent
(
**
kw
)
# </ERP5>
# </ERP5>
ob
.
PUT
(
REQUEST
,
RESPONSE
)
ob
.
PUT
(
REQUEST
,
RESPONSE
)
RESPONSE
.
setStatus
(
201
)
RESPONSE
.
setStatus
(
201
)
RESPONSE
.
setBody
(
''
)
RESPONSE
.
setBody
(
''
)
return
RESPONSE
return
RESPONSE
NullResource
.
PUT
=
PUT
NullResource
.
PUT
=
PUT
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.WebDAVSupport.xml
0 → 100644
View file @
21becf4c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Module Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
WebDAVSupport
</string>
</value>
</item>
<item>
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5Type.WebDAVSupport
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
module.erp5.WebDAVSupport
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Module 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"
>
AAAAAAAAAAI=
</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>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<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>
product/ERP5/bootstrap/erp5_core/bt/template_module_component_id_list
View file @
21becf4c
...
@@ -4,4 +4,5 @@ module.erp5.ExpandPolicy
...
@@ -4,4 +4,5 @@ module.erp5.ExpandPolicy
module.erp5.GeneratedAmountList
module.erp5.GeneratedAmountList
module.erp5.Log
module.erp5.Log
module.erp5.MovementCollectionDiff
module.erp5.MovementCollectionDiff
module.erp5.MovementGroup
module.erp5.MovementGroup
\ No newline at end of file
module.erp5.WebDAVSupport
\ No newline at end of file
Arnaud Fontaine
@arnau
mentioned in commit
b72eff1a
·
Jul 03, 2020
mentioned in commit
b72eff1a
mentioned in commit b72eff1ab4c2a82ba98135c0ba3fdfbfb7934d1a
Toggle commit list
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