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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
b229ea94
Commit
b229ea94
authored
Jun 28, 2013
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make caching policy manager effective in view() of any classes.
parent
32d7aa6a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
16 deletions
+11
-16
product/ERP5/Document/Image.py
product/ERP5/Document/Image.py
+0
-1
product/ERP5/Document/PDFDocument.py
product/ERP5/Document/PDFDocument.py
+0
-1
product/ERP5/Document/TextDocument.py
product/ERP5/Document/TextDocument.py
+0
-5
product/ERP5/Document/WebSection.py
product/ERP5/Document/WebSection.py
+0
-2
product/ERP5/mixin/downloadable.py
product/ERP5/mixin/downloadable.py
+6
-5
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+5
-2
No files found.
product/ERP5/Document/Image.py
View file @
b229ea94
...
...
@@ -39,7 +39,6 @@ from AccessControl import ClassSecurityInfo
from
Acquisition
import
aq_base
from
DocumentTemplate.DT_Util
import
html_quote
from
Products.CMFCore.utils
import
_setCacheHeaders
,
_ViewEmulator
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.Utils
import
fill_args_from_request
from
Products.ERP5.Document.File
import
File
...
...
product/ERP5/Document/PDFDocument.py
View file @
b229ea94
...
...
@@ -29,7 +29,6 @@
import
tempfile
,
os
from
AccessControl
import
ClassSecurityInfo
from
Products.CMFCore.utils
import
_setCacheHeaders
,
_ViewEmulator
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5.Document.Image
import
Image
...
...
product/ERP5/Document/TextDocument.py
View file @
b229ea94
...
...
@@ -30,7 +30,6 @@
from
AccessControl.ZopeGuards
import
guarded_getattr
from
AccessControl
import
ClassSecurityInfo
from
zLOG
import
LOG
,
WARNING
from
Products.CMFCore.utils
import
_setCacheHeaders
,
_ViewEmulator
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5.Document.Document
import
Document
,
ConversionError
,
_MARKER
,
DEFAULT_CONTENT_TYPE
from
Products.ERP5.Document.File
import
File
...
...
@@ -195,10 +194,6 @@ class TextDocument(CachedConvertableMixin, BaseConvertableFileMixin,
# text_content is not set, return empty string instead of None
return
original_mime_type
,
''
def
__call__
(
self
):
_setCacheHeaders
(
_ViewEmulator
().
__of__
(
self
),
{})
return
Document
.
__call__
(
self
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getContentBaseURL'
)
def
getContentBaseURL
(
self
):
"""
...
...
product/ERP5/Document/WebSection.py
View file @
b229ea94
...
...
@@ -28,7 +28,6 @@
##############################################################################
from
AccessControl
import
ClassSecurityInfo
from
Products.CMFCore.utils
import
_setCacheHeaders
,
_ViewEmulator
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5.Document.Domain
import
Domain
from
Products.ERP5.mixin.extensible_traversable
import
DocumentExtensibleTraversableMixin
...
...
@@ -200,7 +199,6 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
We use REQUEST parameters so that they are reset for every
Web transaction and can be accessed from widgets.
"""
_setCacheHeaders
(
_ViewEmulator
().
__of__
(
self
),
{})
# Register current web site physical path for later URL generation
if
self
.
REQUEST
.
get
(
self
.
web_section_key
,
MARKER
)
is
MARKER
:
self
.
REQUEST
[
self
.
web_section_key
]
=
self
.
getPhysicalPath
()
...
...
product/ERP5/mixin/downloadable.py
View file @
b229ea94
...
...
@@ -67,11 +67,6 @@ class DownloadableMixin:
"""
from
Products.ERP5.Document.Document
import
VALID_TEXT_FORMAT_LIST
,
\
VALID_IMAGE_FORMAT_LIST
web_cache_kw
=
kw
.
copy
()
if
format
is
not
_MARKER
:
web_cache_kw
[
'format'
]
=
format
_setCacheHeaders
(
_ViewEmulator
().
__of__
(
self
),
web_cache_kw
)
if
format
is
_MARKER
and
not
kw
:
# conversion parameters is mandatory to download the converted content.
# By default allways return view action.
...
...
@@ -79,6 +74,12 @@ class DownloadableMixin:
return
self
.
view
()
if
format
is
_MARKER
:
format
=
None
web_cache_kw
=
kw
.
copy
()
if
format
:
web_cache_kw
[
'format'
]
=
format
_setCacheHeaders
(
_ViewEmulator
().
__of__
(
self
),
web_cache_kw
)
if
not
self
.
checkConversionFormatPermission
(
format
,
**
kw
):
raise
Forbidden
(
'You are not allowed to get this document in this '
\
'format'
)
...
...
product/ERP5Type/Base.py
View file @
b229ea94
...
...
@@ -51,7 +51,7 @@ from ZopePatch import ERP5PropertyManager
from
Products.CMFCore.PortalContent
import
PortalContent
from
Products.CMFCore.Expression
import
Expression
from
Products.CMFCore.utils
import
getToolByName
from
Products.CMFCore.utils
import
getToolByName
,
_setCacheHeaders
,
_ViewEmulator
from
Products.CMFCore.WorkflowCore
import
ObjectDeleted
,
ObjectMoved
from
Products.CMFCore.CMFCatalogAware
import
CMFCatalogAware
...
...
@@ -2422,7 +2422,10 @@ class Base( CopyContainer,
security
.
declareProtected
(
Permissions
.
View
,
'view'
)
def
view
(
self
):
"""Returns the default view even if index_html is overridden"""
return
self
.
_renderDefaultView
(
'view'
)
result
=
self
.
_renderDefaultView
(
'view'
)
# call caching policy manager.
_setCacheHeaders
(
_ViewEmulator
().
__of__
(
self
),
{})
return
result
# Default views - the default security in CMFCore
# is View - however, security was not defined on
...
...
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