Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arnaud Fontaine
erp5
Commits
13f13eb8
Commit
13f13eb8
authored
13 years ago
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ZSQLCatalog to filter convertable documents.
Use getTypeBasedMethod and unify handlers.
parent
a0ee2634
No related merge requests found
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
52 additions
and
48 deletions
+52
-48
bt5/erp5_dms_conversion_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_preConvertDocumentList.catalog_keys.xml
...innodb/SQLCatalog_preConvertDocumentList.catalog_keys.xml
+9
-0
bt5/erp5_dms_conversion_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_preConvertDocumentList.xml
...g/erp5_mysql_innodb/SQLCatalog_preConvertDocumentList.xml
+4
-7
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/Base_callPreConvert.xml
...skins/erp5_dms_conversion_catalog/Base_callPreConvert.xml
+14
-16
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/Base_preConvert.xml
...tal_skins/erp5_dms_conversion_catalog/Base_preConvert.xml
+15
-13
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/ERP5Site_preConvertDocumentList.xml
...ms_conversion_catalog/ERP5Site_preConvertDocumentList.xml
+1
-1
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/Image_preConvert.xml
...al_skins/erp5_dms_conversion_catalog/Image_preConvert.xml
+3
-4
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/OOoDocument_preConvert.xml
...ns/erp5_dms_conversion_catalog/OOoDocument_preConvert.xml
+2
-2
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/TextDocument_preConvert.xml
...s/erp5_dms_conversion_catalog/TextDocument_preConvert.xml
+3
-4
bt5/erp5_dms_conversion_catalog/bt/revision
bt5/erp5_dms_conversion_catalog/bt/revision
+1
-1
No files found.
bt5/erp5_dms_conversion_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_preConvertDocumentList.catalog_keys.xml
View file @
13f13eb8
...
@@ -2,4 +2,13 @@
...
@@ -2,4 +2,13 @@
<item
key=
"sql_catalog_object_list"
type=
"int"
>
<item
key=
"sql_catalog_object_list"
type=
"int"
>
<value>
1
</value>
<value>
1
</value>
</item>
</item>
<item
key=
"_is_filtered_archive"
type=
"int"
>
<value>
1
</value>
</item>
<item
key=
"_filter_expression_archive"
type=
"str"
>
<value>
python: context.isDocument()
</value>
</item>
<item
key=
"_filter_expression_cache_key_archive"
type=
"tuple"
>
<value>
portal_type
</value>
</item>
</catalog_method>
</catalog_method>
This diff is collapsed.
Click to expand it.
bt5/erp5_dms_conversion_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_preConvertDocumentList.xml
View file @
13f13eb8
...
@@ -51,7 +51,6 @@
...
@@ -51,7 +51,6 @@
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
<value>
<string>
portal = context.getPortalObject()\n
portal_id = portal.getId()\n
MARKER = (None, \'\',)\n
MARKER = (None, \'\',)\n
\n
\n
address = portal.portal_preferences.getPreferredOoodocServerAddress()\n
address = portal.portal_preferences.getPreferredOoodocServerAddress()\n
...
@@ -61,18 +60,16 @@ port = portal.portal_preferences.getPreferredOoodocServerPortNumber()\n
...
@@ -61,18 +60,16 @@ port = portal.portal_preferences.getPreferredOoodocServerPortNumber()\n
# is installed BEFORE the real cloudoo is setup in preferences.\n
# is installed BEFORE the real cloudoo is setup in preferences.\n
if address not in MARKER and port not in MARKER:\n
if address not in MARKER and port not in MARKER:\n
for index_uid in range(len(uid)):\n
for index_uid in range(len(uid)):\n
document_relative_url = get
Path[index_uid].replace("/%s/" %portal_id, "")
\n
document_relative_url = get
RelativeUrl[index_uid]
\n
document = portal.restrictedTraverse(document_relative_url)\n
document = portal.restrictedTraverse(document_relative_url)\n
if getattr(document, "convert", None) is not None and \\\n
if (document.getData() not in MARKER or document.getBaseData() not in MARKER):\n
getattr(document, "getData", None) is not None and \\\n
(document.getData() not in MARKER or document.getBaseData() not in MARKER):\n
#context.log("preconvert %s" %document.getRelativeUrl())\n
#context.log("preconvert %s" %document.getRelativeUrl())\n
document.activate(serialize_tag="conversion").Base_
p
reConvert()\n
document.activate(serialize_tag="conversion").Base_
callP
reConvert()\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
uid, get
Path
</string>
</value>
<value>
<string>
uid, get
RelativeUrl
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/
Document_p
reConvert.xml
→
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/
Base_callP
reConvert.xml
View file @
13f13eb8
...
@@ -51,32 +51,30 @@
...
@@ -51,32 +51,30 @@
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
<value>
<string>
"""\n
Do actual conversion of any Document type.\n
Pre convert to know good defaults.\n
Use type based methods to allow finer granularity (for example in case of PDF we support many frames inside a document).\n
"""\n
"""\n
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
\n
\n
format_kw = {\'format\': format,\n
portal_type = context.getPortalType()\n
\'quality\': quality}\n
format = portal.portal_preferences.getPreferredImageFormat()\n
for display in display_list:\n
quality = portal.portal_preferences.getPreferredImageQuality()\n
format_kw[\'display\'] = display\n
preferred_image_size = portal.portal_preferences.getPreferredImageSize()\n
context.convert(**format_kw)\n
\n
# thumbnail is required always\n
display_list = ["thumbnail"]\n
method = context.getTypeBasedMethod(\'preConvert\')\n
context.log(method)\n
return method(**dict(format=format, quality=quality, display_list = display_list))\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
format, quality, display_list
</string>
</value>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Document_p
reConvert
</string>
</value>
<value>
<string>
Base_callP
reConvert
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/Base_preConvert.xml
View file @
13f13eb8
...
@@ -51,26 +51,28 @@
...
@@ -51,26 +51,28 @@
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
<value>
<string>
"""\n
Pre convert to know good defaults.\n
Do actual conversion of any Base type.\n
Use type based methods to allow finer granularity (for example in case of PDF we support many frames inside a document).\n
"""\n
"""\n
portal = context.getPortalObject()\n
portal = context.getPortalObject()\n
\n
\n
portal_type = context.getPortalType()\n
format_kw = {\'format\': format,\n
format = portal.portal_preferences.getPreferredImageFormat()\n
\'quality\': quality}\n
quality = portal.portal_preferences.getPreferredImageQuality()\n
for display in display_list:\n
preferred_image_size = portal.portal_preferences.getPreferredImageSize()\n
format_kw[\'display\'] = display\n
\n
context.convert(**format_kw)\n
# thumbnail is required always\n
display_list = ["thumbnail"]\n
method_id = \'%s_preConvert\' %portal_type.replace(\' \', \'\')\n
method = getattr(context, method_id, context.Document_preConvert)\n
return method(**dict(format=format, quality=quality, display_list = display_list))\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
format, quality, display_list
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/ERP5Site_preConvertDocumentList.xml
View file @
13f13eb8
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
It will do that recursively in entire ERP5 instance.\n
It will do that recursively in entire ERP5 instance.\n
\n
\n
"""\n
"""\n
context.ERP5Site_checkDataWithScript("Base_
p
reConvert", \n
context.ERP5Site_checkDataWithScript("Base_
callP
reConvert", \n
tag="pre_convert",\n
tag="pre_convert",\n
packet=2,\n
packet=2,\n
id_list=["document_module", "image_module"])\n
id_list=["document_module", "image_module"])\n
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/
Text
_preConvert.xml
→
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/
Image
_preConvert.xml
View file @
13f13eb8
...
@@ -51,10 +51,9 @@
...
@@ -51,10 +51,9 @@
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
<value>
<string>
"""\n
Do actual conversion of
Spreadsheet
type.\n
Do actual conversion of
any Image
type.\n
"""\n
"""\n
context.convert(**{\'format\': \'html\'})\n
context.Base_preConvert(format, quality, display_list)\n
context.Document_preConvert(format, quality, display_list)\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
@@ -71,7 +70,7 @@ context.Document_preConvert(format, quality, display_list)\n
...
@@ -71,7 +70,7 @@ context.Document_preConvert(format, quality, display_list)\n
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Text
_preConvert
</string>
</value>
<value>
<string>
Image
_preConvert
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/
Spreadshee
t_preConvert.xml
→
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/
OOoDocumen
t_preConvert.xml
View file @
13f13eb8
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
Do actual conversion of Spreadsheet type.\n
Do actual conversion of Spreadsheet type.\n
"""\n
"""\n
context.convert(**{\'format\': \'html\'})\n
context.convert(**{\'format\': \'html\'})\n
context.
Document
_preConvert(format, quality, display_list)\n
context.
Base
_preConvert(format, quality, display_list)\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
@@ -71,7 +71,7 @@ context.Document_preConvert(format, quality, display_list)\n
...
@@ -71,7 +71,7 @@ context.Document_preConvert(format, quality, display_list)\n
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Spreadshee
t_preConvert
</string>
</value>
<value>
<string>
OOoDocumen
t_preConvert
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/
Drawing
_preConvert.xml
→
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/
TextDocument
_preConvert.xml
View file @
13f13eb8
...
@@ -51,10 +51,9 @@
...
@@ -51,10 +51,9 @@
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
<value>
<string>
"""\n
Do actual conversion of
Spreadsheet
type.\n
Do actual conversion of
any Image
type.\n
"""\n
"""\n
context.convert(**{\'format\': \'html\'})\n
context.Base_preConvert(format, quality, display_list)\n
context.Document_preConvert(format, quality, display_list)\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
@@ -71,7 +70,7 @@ context.Document_preConvert(format, quality, display_list)\n
...
@@ -71,7 +70,7 @@ context.Document_preConvert(format, quality, display_list)\n
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Drawing
_preConvert
</string>
</value>
<value>
<string>
TextDocument
_preConvert
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms_conversion_catalog/bt/revision
View file @
13f13eb8
5
6
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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