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
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
erp5
Commits
12366b5d
Commit
12366b5d
authored
Jul 28, 2014
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support 304 (Not Modified) response where we support caching policy manager.
parent
0accb3ef
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
8 deletions
+31
-8
product/ERP5/Document/WebSection.py
product/ERP5/Document/WebSection.py
+8
-2
product/ERP5/mixin/downloadable.py
product/ERP5/mixin/downloadable.py
+8
-2
product/ERP5/mixin/extensible_traversable.py
product/ERP5/mixin/extensible_traversable.py
+8
-2
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+7
-2
No files found.
product/ERP5/Document/WebSection.py
View file @
12366b5d
...
@@ -37,7 +37,7 @@ from AccessControl import Unauthorized
...
@@ -37,7 +37,7 @@ from AccessControl import Unauthorized
from
OFS.Traversable
import
NotFound
from
OFS.Traversable
import
NotFound
from
Persistence
import
Persistent
from
Persistence
import
Persistent
from
ZPublisher
import
BeforeTraverse
from
ZPublisher
import
BeforeTraverse
from
Products.CMFCore.utils
import
_setCacheHeaders
,
_ViewEmulator
from
Products.CMFCore.utils
import
_
checkConditionalGET
,
_
setCacheHeaders
,
_ViewEmulator
from
Products.ERP5Type.Cache
import
getReadOnlyTransactionCache
from
Products.ERP5Type.Cache
import
getReadOnlyTransactionCache
...
@@ -234,7 +234,13 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
...
@@ -234,7 +234,13 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
if
document
is
None
:
if
document
is
None
:
document
=
self
document
=
self
result
=
getattr
(
document
,
custom_render_method_id
)()
result
=
getattr
(
document
,
custom_render_method_id
)()
_setCacheHeaders
(
_ViewEmulator
().
__of__
(
self
),
{})
view
=
_ViewEmulator
().
__of__
(
self
)
# If we have a conditional get, set status 304 and return
# no content
if
_checkConditionalGET
(
view
,
extra_context
=
{}):
return
''
# call caching policy manager.
_setCacheHeaders
(
view
,
{})
return
result
return
result
elif
document
is
not
None
:
elif
document
is
not
None
:
return
document
()
return
document
()
...
...
product/ERP5/mixin/downloadable.py
View file @
12366b5d
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
from
AccessControl
import
ClassSecurityInfo
,
Unauthorized
from
AccessControl
import
ClassSecurityInfo
,
Unauthorized
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.Utils
import
fill_args_from_request
from
Products.ERP5Type.Utils
import
fill_args_from_request
from
Products.CMFCore.utils
import
getToolByName
,
_setCacheHeaders
,
\
from
Products.CMFCore.utils
import
getToolByName
,
_
checkConditionalGET
,
_
setCacheHeaders
,
\
_ViewEmulator
_ViewEmulator
import
warnings
import
warnings
from
zExceptions
import
Forbidden
from
zExceptions
import
Forbidden
...
@@ -78,7 +78,13 @@ class DownloadableMixin:
...
@@ -78,7 +78,13 @@ class DownloadableMixin:
web_cache_kw
=
kw
.
copy
()
web_cache_kw
=
kw
.
copy
()
if
format
:
if
format
:
web_cache_kw
[
'format'
]
=
format
web_cache_kw
[
'format'
]
=
format
_setCacheHeaders
(
_ViewEmulator
().
__of__
(
self
),
web_cache_kw
)
view
=
_ViewEmulator
().
__of__
(
self
)
# If we have a conditional get, set status 304 and return
# no content
if
_checkConditionalGET
(
view
,
web_cache_kw
):
return
''
# call caching policy manager.
_setCacheHeaders
(
view
,
web_cache_kw
)
if
not
self
.
checkConversionFormatPermission
(
format
,
**
kw
):
if
not
self
.
checkConversionFormatPermission
(
format
,
**
kw
):
raise
Forbidden
(
'You are not allowed to get this document in this '
\
raise
Forbidden
(
'You are not allowed to get this document in this '
\
...
...
product/ERP5/mixin/extensible_traversable.py
View file @
12366b5d
...
@@ -36,7 +36,7 @@ from Products.ERP5Type.Cache import getReadOnlyTransactionCache
...
@@ -36,7 +36,7 @@ from Products.ERP5Type.Cache import getReadOnlyTransactionCache
from
AccessControl
import
ClassSecurityInfo
,
getSecurityManager
from
AccessControl
import
ClassSecurityInfo
,
getSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
,
setSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
,
setSecurityManager
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type
import
Permissions
from
Products.CMFCore.utils
import
getToolByName
,
_setCacheHeaders
,
_ViewEmulator
from
Products.CMFCore.utils
import
getToolByName
,
_
checkConditionalGET
,
_
setCacheHeaders
,
_ViewEmulator
from
OFS.Image
import
File
as
OFSFile
from
OFS.Image
import
File
as
OFSFile
from
warnings
import
warn
from
warnings
import
warn
import
sys
import
sys
...
@@ -213,7 +213,13 @@ class OOoDocumentExtensibleTraversableMixin(BaseExtensibleTraversableMixin):
...
@@ -213,7 +213,13 @@ class OOoDocumentExtensibleTraversableMixin(BaseExtensibleTraversableMixin):
'format'
:
EMBEDDED_FORMAT
}
'format'
:
EMBEDDED_FORMAT
}
try
:
try
:
self
.
_convert
(
format
=
'html'
)
self
.
_convert
(
format
=
'html'
)
_setCacheHeaders
(
_ViewEmulator
().
__of__
(
self
),
web_cache_kw
)
view
=
_ViewEmulator
().
__of__
(
self
)
# If we have a conditional get, set status 304 and return
# no content
if
_checkConditionalGET
(
view
,
web_cache_kw
):
return
''
# call caching policy manager.
_setCacheHeaders
(
view
,
web_cache_kw
)
mime
,
data
=
self
.
getConversion
(
format
=
EMBEDDED_FORMAT
,
filename
=
name
)
mime
,
data
=
self
.
getConversion
(
format
=
EMBEDDED_FORMAT
,
filename
=
name
)
document
=
OFSFile
(
name
,
name
,
data
,
content_type
=
mime
).
__of__
(
self
.
aq_parent
)
document
=
OFSFile
(
name
,
name
,
data
,
content_type
=
mime
).
__of__
(
self
.
aq_parent
)
except
(
NotConvertedError
,
ConversionError
,
KeyError
):
except
(
NotConvertedError
,
ConversionError
,
KeyError
):
...
...
product/ERP5Type/Base.py
View file @
12366b5d
...
@@ -51,7 +51,7 @@ from ZopePatch import ERP5PropertyManager
...
@@ -51,7 +51,7 @@ from ZopePatch import ERP5PropertyManager
from
Products.CMFCore.PortalContent
import
PortalContent
from
Products.CMFCore.PortalContent
import
PortalContent
from
Products.CMFCore.Expression
import
Expression
from
Products.CMFCore.Expression
import
Expression
from
Products.CMFCore.utils
import
getToolByName
,
_setCacheHeaders
,
_ViewEmulator
from
Products.CMFCore.utils
import
getToolByName
,
_
checkConditionalGET
,
_
setCacheHeaders
,
_ViewEmulator
from
Products.CMFCore.WorkflowCore
import
ObjectDeleted
,
ObjectMoved
from
Products.CMFCore.WorkflowCore
import
ObjectDeleted
,
ObjectMoved
from
Products.CMFCore.CMFCatalogAware
import
CMFCatalogAware
from
Products.CMFCore.CMFCatalogAware
import
CMFCatalogAware
...
@@ -2415,8 +2415,13 @@ class Base( CopyContainer,
...
@@ -2415,8 +2415,13 @@ class Base( CopyContainer,
def
view
(
self
):
def
view
(
self
):
"""Returns the default view even if index_html is overridden"""
"""Returns the default view even if index_html is overridden"""
result
=
self
.
_renderDefaultView
(
'view'
)
result
=
self
.
_renderDefaultView
(
'view'
)
view
=
_ViewEmulator
().
__of__
(
self
)
# If we have a conditional get, set status 304 and return
# no content
if
_checkConditionalGET
(
view
,
extra_context
=
{}):
return
''
# call caching policy manager.
# call caching policy manager.
_setCacheHeaders
(
_ViewEmulator
().
__of__
(
self
)
,
{})
_setCacheHeaders
(
view
,
{})
return
result
return
result
# Default views - the default security in CMFCore
# Default views - the default security in CMFCore
...
...
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