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
Bryan Kaperick
erp5
Commits
8383758b
Commit
8383758b
authored
Jan 20, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into lazy_simulation_causality
parents
3cca5327
5161a9e3
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
205 additions
and
137 deletions
+205
-137
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryMapping.xml
...al_skins/erp5_dms/ERP5Type_getSecurityCategoryMapping.xml
+0
-81
bt5/erp5_dms/bt/revision
bt5/erp5_dms/bt/revision
+1
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebPage_getStandardSubstitutionMappingDict.xml
...s/erp5_web/WebPage_getStandardSubstitutionMappingDict.xml
+12
-5
bt5/erp5_web/bt/revision
bt5/erp5_web/bt/revision
+1
-1
erp5/util/README.webchecker.txt
erp5/util/README.webchecker.txt
+11
-0
erp5/util/webchecker/__init__.py
erp5/util/webchecker/__init__.py
+145
-24
product/ERP5/Document/TextDocument.py
product/ERP5/Document/TextDocument.py
+7
-5
product/ERP5OOo/tests/testDms.py
product/ERP5OOo/tests/testDms.py
+16
-10
product/ERP5OOo/transforms/oood_commandtransform.py
product/ERP5OOo/transforms/oood_commandtransform.py
+10
-1
product/ERP5SyncML/Document/SyncMLPublication.py
product/ERP5SyncML/Document/SyncMLPublication.py
+1
-7
product/ERP5SyncML/Document/SyncMLSubscription.py
product/ERP5SyncML/Document/SyncMLSubscription.py
+1
-2
No files found.
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/ERP5Type_getSecurityCategoryMapping.xml
deleted
100644 → 0
View file @
3cca5327
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
Core security script - defines the way to get security groups of the current user.\n
\n
WARNING: providing such script in erp5_dms could be dangerous\n
if this conflicts with an existing production site which uses\n
deprecated ERP5Type_asSecurityGroupIdList\n
"""\n
\n
return (\n
(\'ERP5Type_getSecurityCategoryFromAssignmentStrict\', [\'function\'] ),\n
(\'ERP5Type_getSecurityCategoryFromAssignmentStrict\', [\'follow_up\'] ),\n
(\'ERP5Type_getSecurityCategoryFromAssignmentStrict\', [\'function\', \'follow_up\'] ),\n
(\'ERP5Type_getSecurityCategoryFromAssignmentStrict\', [\'group\'] ),\n
(\'ERP5Type_getSecurityCategoryRoot\', [\'group\']),\n
)\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Type_getSecurityCategoryMapping
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_dms/bt/revision
View file @
8383758b
1261
\ No newline at end of file
1262
\ No newline at end of file
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebPage_getStandardSubstitutionMappingDict.xml
View file @
8383758b
...
...
@@ -59,11 +59,18 @@
# your own script instead.\n
\n
website = context.getWebSiteValue()\n
websection = context.getWebSectionValue()\n
\n
return dict(website_url=website.absolute_url(),\n
websection_url=websection.absolute_url(),\n
webpage_url=websection.getPermanentURL(context))\n
if website is None:\n
# handle the case when substitution happens on web page module context (i.e. reindex, or mass pre conversion)\n
# then fall back to ERP5 site as a Web Site\n
website = context.getPortalObject()\n
return dict(website_url=website.absolute_url(),\n
websection_url=website.absolute_url(),\n
webpage_url=context.absolute_url())\n
else:\n
websection = context.getWebSectionValue()\n
return dict(website_url=website.absolute_url(),\n
websection_url=websection.absolute_url(),\n
webpage_url=websection.getPermanentURL(context))\n
</string>
</value>
</item>
<item>
...
...
bt5/erp5_web/bt/revision
View file @
8383758b
1074
\ No newline at end of file
1075
\ No newline at end of file
erp5/util/README.webchecker.txt
View file @
8383758b
...
...
@@ -21,6 +21,17 @@ Vary = Accept-Language, Cookie, Accept-Encoding
Accept-Language,Cookie
Expires = True
[header url=.*/sitemap]
Last-Modified = True
[header content-type=.*/javascript]
Last-Modified = True
Cache-Control = max-age=3600
Expires = True
[no_header content-type=(image/.*|text/css)]
Vary = None
[erp5_extension_list]
prohibited_file_name_list = WebSection_viewAsWeb
Base_viewHistory
...
...
erp5/util/webchecker/__init__.py
View file @
8383758b
This diff is collapsed.
Click to expand it.
product/ERP5/Document/TextDocument.py
View file @
8383758b
...
...
@@ -36,7 +36,7 @@ from Products.ERP5.Document.Document import Document, ConversionError, _MARKER,
from
Products.ERP5.Document.File
import
File
from
Products.ERP5Type.WebDAVSupport
import
TextContent
import
re
from
Products.ERP5.Document.Document
import
VALID_IMAGE_FORMAT_LIST
from
Products.ERP5.Document.Document
import
VALID_IMAGE_FORMAT_LIST
,
VALID_TEXT_FORMAT_LIST
import
cStringIO
from
string
import
Template
...
...
@@ -179,10 +179,12 @@ class TextDocument(CachedConvertableMixin, BaseConvertableFileMixin,
self
.
setConversion
(
result
,
original_mime_type
,
**
kw
)
else
:
mime_type
,
result
=
self
.
getConversion
(
**
kw
)
if
substitution_method_parameter_dict
is
None
:
substitution_method_parameter_dict
=
{}
result
=
self
.
_substituteTextContent
(
result
,
safe_substitute
=
safe_substitute
,
**
substitution_method_parameter_dict
)
if
format
in
VALID_TEXT_FORMAT_LIST
:
# only textual content can be sustituted
if
substitution_method_parameter_dict
is
None
:
substitution_method_parameter_dict
=
{}
result
=
self
.
_substituteTextContent
(
result
,
safe_substitute
=
safe_substitute
,
**
substitution_method_parameter_dict
)
return
original_mime_type
,
result
else
:
# text_content is not set, return empty string instead of None
...
...
product/ERP5OOo/tests/testDms.py
View file @
8383758b
...
...
@@ -2021,7 +2021,8 @@ return 1
def
test_convertWebPageWithEmbeddedZODBImageToImageOnTraversal
(
self
):
"""
Test Web Page using embedded Images into ZODB case (in its HTML body)
Test Web Page conversion to image using embedded Images into its HTML body.
Test various dumb ways to include an image (relative to instance or external ones).
"""
display
=
'thumbnail'
convert_kw
=
{
'display'
:
display
,
...
...
@@ -2037,36 +2038,39 @@ return 1
web_page_image_size
,
web_page_file_size
=
self
.
getURLSizeList
(
web_page_document_url
,
**
convert_kw
)
self
.
assertTrue
(
max
(
preffered_size_for_display
)
-
max
(
web_page_image_size
)
<=
1
)
# XXX: how to simulate the case when web page contains (through reference) link to document for which based conversion failed?
# XXX: how to fix case when web page contains (through reference) link to itself (causes infinite recursion)
# images from same instance accessed by reference and wrong arguments (dispay NOT display)
# images from same instance accessed by reference and wrong conversion arguments (dispay NOT display)
# code should be more resilient
upload_file
=
makeFileUpload
(
'cmyk_sample.jpg'
)
image
=
self
.
portal
.
image_module
.
newContent
(
portal_type
=
'Image'
,
reference
=
'Embedded-XXX'
,
version
=
'001'
,
language
=
'en'
)
image
.
setData
(
upload_file
.
read
())
image
.
publish
()
convert_kw
[
'quality'
]
=
99
# to not get cached
web_page_document
=
self
.
portal
.
web_page_module
.
newContent
(
portal_type
=
"Web Page"
)
web_page_document
.
setTextContent
(
'''<b> test </b><img src="Embedded-XXX?format=jpeg&dispay=medium"/>'''
)
web_page_document
.
setTextContent
(
'''<b> test </b><img src="Embedded-XXX?format=jpeg&dispay=medium
&quality=50
"/>'''
)
self
.
stepTic
()
web_page_document_url
=
'%s/%s'
%
(
self
.
portal
.
absolute_url
(),
web_page_document
.
getRelativeUrl
())
web_page_image_size
,
web_page_file_size
=
self
.
getURLSizeList
(
web_page_document_url
,
**
convert_kw
)
self
.
assertTrue
(
max
(
preffered_size_for_display
)
-
max
(
web_page_image_size
)
<=
1
)
# external images
convert_kw
[
'quality'
]
=
98
# to not get cached
convert_kw
[
'quality'
]
=
98
web_page_document
=
self
.
portal
.
web_page_module
.
newContent
(
portal_type
=
"Web Page"
)
web_page_document
.
setTextContent
(
'''<b> test </b><img src="http://www.erp5.com/images/favourite.png"/>
<img style="width: 26px; height: 26px;" src="http://www.erp5.com//images/save2.png" />
<img style="width: 26px; height: 26px;" src="http:////www.erp5.com//images/save2.png" />
<img style="width: 26px; height: 26px;" src="http://www.erp5.com/./images/save2.png" />
'''
)
self
.
stepTic
()
web_page_document_url
=
'%s/%s'
%
(
self
.
portal
.
absolute_url
(),
web_page_document
.
getRelativeUrl
())
web_page_image_size
,
web_page_file_size
=
self
.
getURLSizeList
(
web_page_document_url
,
**
convert_kw
)
self
.
assertTrue
(
max
(
preffered_size_for_display
)
-
max
(
web_page_image_size
)
<=
1
)
# XXX: how to simulate the case when web page contains (through reference) link to document for which based conversion failed?
# XXX: how to fix case when web page contains (through reference) link to itself (causes infinite recursion)
def
test_convertToImageOnTraversal
(
self
):
"""
...
...
@@ -2091,7 +2095,9 @@ return 1
image_document
.
edit
(
file
=
upload_file
)
web_page_document
=
self
.
portal
.
web_page_module
.
newContent
(
portal_type
=
"Web Page"
)
web_page_document
.
setTextContent
(
'<b> test </b>'
)
web_page_document
.
setTextContent
(
'<b> test </b> $website_url $website_url'
)
# a Web Page can generate dynamic text so test is as well
web_page_document
.
setTextContentSubstitutionMappingMethodId
(
'WebPage_getStandardSubstitutionMappingDict'
)
self
.
stepTic
()
ooo_document_url
=
'%s/%s'
%
(
self
.
portal
.
absolute_url
(),
ooo_document
.
getRelativeUrl
())
...
...
@@ -2704,8 +2710,8 @@ class TestDocumentPerformance(TestDocumentMixin):
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestDocument
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestDocumentWithSecurity
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestDocumentPerformance
))
#
suite.addTest(unittest.makeSuite(TestDocumentWithSecurity))
#
suite.addTest(unittest.makeSuite(TestDocumentPerformance))
return
suite
...
...
product/ERP5OOo/transforms/oood_commandtransform.py
View file @
8383758b
...
...
@@ -110,8 +110,10 @@ class OOOdCommandTransform(commandtransform):
url
=
href_attribute_list
[
0
]
parse_result
=
urlparse
(
unquote
(
url
))
# urlparse return a 6-tuple: scheme, netloc, path, params, query, fragment
netloc
=
parse_result
[
1
]
path
=
parse_result
[
2
]
if
path
:
if
path
and
netloc
in
(
''
,
None
):
# it makes sense to include only relative to current site images not remote ones which can be taken by OOo
# OOo corrupt relative Links inside HTML content during odt conversion
# <img src="REF.TO.IMAGE" ... /> become <draw:image xlink:href="../REF.TO.IMAGE" ... />
# So remove "../" added by OOo
...
...
@@ -119,6 +121,9 @@ class OOOdCommandTransform(commandtransform):
# in some cases like Web Page content "/../" can be contained in image URL which will break
# restrictedTraverse calls, our best guess is to remove it
path
=
path
.
replace
(
'/../'
,
''
)
# remove occurencies of '//' or '///' in path (happens with web pages) and leave
# a traversable relative URL
path
=
'/'
.
join
([
x
for
x
in
path
.
split
(
'/'
)
if
x
.
strip
()
!=
''
])
# retrieve http parameters and use them to convert image
query_parameter_string
=
parse_result
[
4
]
image_parameter_dict
=
dict
(
parse_qsl
(
query_parameter_string
))
...
...
@@ -131,6 +136,10 @@ class OOOdCommandTransform(commandtransform):
odt_content_modified
=
True
content_type
=
image
.
getContentType
()
format
=
image_parameter_dict
.
pop
(
'format'
,
None
)
# convert API accepts only a certail range of arguments
for
key
,
value
in
image_parameter_dict
.
items
():
if
key
not
in
(
'format'
,
'display'
,
'quality'
,
'resolution'
,):
image_parameter_dict
.
pop
(
key
)
if
getattr
(
image
,
'convert'
,
None
)
is
not
None
:
# The document support conversion so perform conversion
# according given parameters
...
...
product/ERP5SyncML/Document/SyncMLPublication.py
View file @
8383758b
...
...
@@ -71,14 +71,8 @@ class SyncMLPublication(SyncMLSubscription):
"""
Reset all subscribers
"""
id_list
=
[]
for
subscriber
in
self
.
contentValues
(
portal_type
=
'SyncML Subscription'
):
subscriber
.
resetSignatureList
()
id_list
.
append
(
subscriber
.
getId
())
self
.
activate
(
activity
=
'SQLQueue'
,
tag
=
self
.
getId
(),
after_tag
=
id_list
,
priority
=
ACTIVITY_PRIORITY
).
manage_delObjects
(
id_list
)
priority
=
ACTIVITY_PRIORITY
).
manage_delObjects
(
ids
=
list
(
self
.
getObjectIds
()))
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getConflictList'
)
...
...
product/ERP5SyncML/Document/SyncMLSubscription.py
View file @
8383758b
...
...
@@ -403,7 +403,6 @@ class SyncMLSubscription(XMLObject):
for
i
in
xrange
(
0
,
object_list_len
,
MAX_OBJECTS
):
current_id_list
=
object_id_list
[
i
:
i
+
MAX_OBJECTS
]
self
.
activate
(
activity
=
'SQLQueue'
,
tag
=
self
.
getId
(),
priority
=
ACTIVITY_PRIORITY
).
manage_delObjects
(
current_id_list
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
...
...
@@ -449,7 +448,7 @@ class SyncMLSubscription(XMLObject):
'conflict_resolved_with_merge'
,
'conflict_resolved_with_client_command_winning'
):
if
self
.
getIsActivityEnabled
():
signature
.
activate
(
tag
=
self
.
getId
(),
activity
=
'SQLQueue'
,
signature
.
activate
(
activity
=
'SQLQueue'
,
priority
=
ACTIVITY_PRIORITY
).
reset
()
else
:
signature
.
reset
()
...
...
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