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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xueyun Qian
erp5
Commits
13f13eb8
Commit
13f13eb8
authored
Oct 28, 2011
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
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 @@
<item
key=
"sql_catalog_object_list"
type=
"int"
>
<value>
1
</value>
</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>
bt5/erp5_dms_conversion_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_preConvertDocumentList.xml
View file @
13f13eb8
...
...
@@ -51,7 +51,6 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
portal = context.getPortalObject()\n
portal_id = portal.getId()\n
MARKER = (None, \'\',)\n
\n
address = portal.portal_preferences.getPreferredOoodocServerAddress()\n
...
...
@@ -61,18 +60,16 @@ port = portal.portal_preferences.getPreferredOoodocServerPortNumber()\n
# is installed BEFORE the real cloudoo is setup in preferences.\n
if address not in MARKER and port not in MARKER:\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
if getattr(document, "convert", None) is not None and \\\n
getattr(document, "getData", None) is not None and \\\n
(document.getData() not in MARKER or document.getBaseData() not in MARKER):\n
if (document.getData() not in MARKER or document.getBaseData() not in MARKER):\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>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
uid, get
Path
</string>
</value>
<value>
<string>
uid, get
RelativeUrl
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
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 @@
<item>
<key>
<string>
_body
</string>
</key>
<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
portal = context.getPortalObject()\n
\n
format_kw = {\'format\': format,\n
\'quality\': quality}\n
for display in display_list:\n
format_kw[\'display\'] = display\n
context.convert(**format_kw)\n
portal_type = context.getPortalType()\n
format = portal.portal_preferences.getPreferredImageFormat()\n
quality = portal.portal_preferences.getPreferredImageQuality()\n
preferred_image_size = portal.portal_preferences.getPreferredImageSize()\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>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
format, quality, display_list
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Document_p
reConvert
</string>
</value>
<value>
<string>
Base_callP
reConvert
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/Base_preConvert.xml
View file @
13f13eb8
...
...
@@ -51,26 +51,28 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\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
Do actual conversion of any Base type.\n
"""\n
portal = context.getPortalObject()\n
\n
portal_type = context.getPortalType()\n
format = portal.portal_preferences.getPreferredImageFormat()\n
quality = portal.portal_preferences.getPreferredImageQuality()\n
preferred_image_size = portal.portal_preferences.getPreferredImageSize()\n
\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
format_kw = {\'format\': format,\n
\'quality\': quality}\n
for display in display_list:\n
format_kw[\'display\'] = display\n
context.convert(**format_kw)\n
</string>
</value>
</item>
<item>
<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>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_dms_conversion_catalog/SkinTemplateItem/portal_skins/erp5_dms_conversion_catalog/ERP5Site_preConvertDocumentList.xml
View file @
13f13eb8
...
...
@@ -56,7 +56,7 @@
It will do that recursively in entire ERP5 instance.\n
\n
"""\n
context.ERP5Site_checkDataWithScript("Base_
p
reConvert", \n
context.ERP5Site_checkDataWithScript("Base_
callP
reConvert", \n
tag="pre_convert",\n
packet=2,\n
id_list=["document_module", "image_module"])\n
...
...
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 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
Do actual conversion of
Spreadsheet
type.\n
Do actual conversion of
any Image
type.\n
"""\n
context.convert(**{\'format\': \'html\'})\n
context.Document_preConvert(format, quality, display_list)\n
context.Base_preConvert(format, quality, display_list)\n
</string>
</value>
</item>
<item>
...
...
@@ -71,7 +70,7 @@ context.Document_preConvert(format, quality, display_list)\n
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Text
_preConvert
</string>
</value>
<value>
<string>
Image
_preConvert
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
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 @@
Do actual conversion of Spreadsheet type.\n
"""\n
context.convert(**{\'format\': \'html\'})\n
context.
Document
_preConvert(format, quality, display_list)\n
context.
Base
_preConvert(format, quality, display_list)\n
</string>
</value>
</item>
<item>
...
...
@@ -71,7 +71,7 @@ context.Document_preConvert(format, quality, display_list)\n
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Spreadshee
t_preConvert
</string>
</value>
<value>
<string>
OOoDocumen
t_preConvert
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
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 @@
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
Do actual conversion of
Spreadsheet
type.\n
Do actual conversion of
any Image
type.\n
"""\n
context.convert(**{\'format\': \'html\'})\n
context.Document_preConvert(format, quality, display_list)\n
context.Base_preConvert(format, quality, display_list)\n
</string>
</value>
</item>
<item>
...
...
@@ -71,7 +70,7 @@ context.Document_preConvert(format, quality, display_list)\n
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Drawing
_preConvert
</string>
</value>
<value>
<string>
TextDocument
_preConvert
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
bt5/erp5_dms_conversion_catalog/bt/revision
View file @
13f13eb8
5
\ No newline at end of file
6
\ No newline at end of file
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