Commit 7c72a354 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Migrate Products.ERP5.Document.Document.

parent 5a3a1624
Pipeline #10561 failed with stage
in 0 seconds
...@@ -40,8 +40,8 @@ from Acquisition import aq_base ...@@ -40,8 +40,8 @@ from Acquisition import aq_base
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Utils import fill_args_from_request from Products.ERP5Type.Utils import fill_args_from_request
from Products.ERP5.Document.File import File from erp5.component.document.File import File
from Products.ERP5.Document.Document import Document, ConversionError,\ from erp5.component.document.Document import Document, ConversionError,\
VALID_TEXT_FORMAT_LIST, VALID_TRANSPARENT_IMAGE_FORMAT_LIST,\ VALID_TEXT_FORMAT_LIST, VALID_TRANSPARENT_IMAGE_FORMAT_LIST,\
DEFAULT_DISPLAY_ID_LIST, _MARKER DEFAULT_DISPLAY_ID_LIST, _MARKER
from os.path import splitext from os.path import splitext
...@@ -52,7 +52,7 @@ from zLOG import LOG, WARNING ...@@ -52,7 +52,7 @@ from zLOG import LOG, WARNING
from erp5.component.module.ImageUtil import transformUrlToDataURI from erp5.component.module.ImageUtil import transformUrlToDataURI
# import mixin # import mixin
from Products.ERP5.mixin.text_convertable import TextConvertableMixin from erp5.component.mixin.TextConvertableMixin import TextConvertableMixin
def getDefaultImageQuality(portal, format=None): # pylint: disable=redefined-builtin def getDefaultImageQuality(portal, format=None): # pylint: disable=redefined-builtin
preference_tool = portal.portal_preferences preference_tool = portal.portal_preferences
......
...@@ -35,24 +35,24 @@ from zope.contenttype import guess_content_type ...@@ -35,24 +35,24 @@ from zope.contenttype import guess_content_type
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5.Document.File import File from erp5.component.document.File import File
from Products.ERP5.Document.Document import Document, \ from erp5.component.document.Document import Document, \
VALID_IMAGE_FORMAT_LIST, ConversionError, NotConvertedError VALID_IMAGE_FORMAT_LIST, ConversionError, NotConvertedError
from Products.ERP5Type.Utils import fill_args_from_request from Products.ERP5Type.Utils import fill_args_from_request
# Mixin Import # Mixin Import
from erp5.component.mixin.BaseConvertableFileMixin import BaseConvertableFileMixin from erp5.component.mixin.BaseConvertableFileMixin import BaseConvertableFileMixin
from Products.ERP5.mixin.text_convertable import TextConvertableMixin from erp5.component.mixin.TextConvertableMixin import TextConvertableMixin
from erp5.component.mixin.OOoDocumentExtensibleTraversableMixin import OOoDocumentExtensibleTraversableMixin from erp5.component.mixin.OOoDocumentExtensibleTraversableMixin import OOoDocumentExtensibleTraversableMixin
EMBEDDED_FORMAT = '_embedded' EMBEDDED_FORMAT = '_embedded'
from Products.ERP5.Document.Document import DocumentConversionServerProxy from erp5.component.document.Document import DocumentConversionServerProxy
# Backward compatibility only # Backward compatibility only
from Products.ERP5.Document.Document import DOCUMENT_CONVERSION_SERVER_PROXY_TIMEOUT as OOO_SERVER_PROXY_TIMEOUT # pylint: disable=unused-import from erp5.component.document.Document import DOCUMENT_CONVERSION_SERVER_PROXY_TIMEOUT as OOO_SERVER_PROXY_TIMEOUT # pylint: disable=unused-import
from Products.ERP5.Document.Document import DOCUMENT_CONVERSION_SERVER_RETRY as OOO_SERVER_RETRY # pylint: disable=unused-import from erp5.component.document.Document import DOCUMENT_CONVERSION_SERVER_RETRY as OOO_SERVER_RETRY # pylint: disable=unused-import
from Products.ERP5.Document.Document import global_server_proxy_uri_failure_time # pylint: disable=unused-import from erp5.component.document.Document import global_server_proxy_uri_failure_time # pylint: disable=unused-import
from Products.ERP5.Document.Document import enc, dec from erp5.component.document.Document import enc, dec
OOoServerProxy = DocumentConversionServerProxy OOoServerProxy = DocumentConversionServerProxy
class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixin, File, class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixin, File,
......
...@@ -33,7 +33,7 @@ from Products.CMFCore.utils import getToolByName ...@@ -33,7 +33,7 @@ from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Utils import deprecated from Products.ERP5Type.Utils import deprecated
from erp5.component.document.Coordinate import Coordinate from erp5.component.document.Coordinate import Coordinate
from Products.ERP5.mixin.url import UrlMixin from erp5.component.mixin.UrlMixin import UrlMixin
from zLOG import LOG from zLOG import LOG
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
from AccessControl.SecurityManagement import setSecurityManager from AccessControl.SecurityManagement import setSecurityManager
from Products.CMFCore.utils import _checkConditionalGET, _setCacheHeaders, _ViewEmulator from Products.CMFCore.utils import _checkConditionalGET, _setCacheHeaders, _ViewEmulator
from OFS.Image import File as OFSFile from OFS.Image import File as OFSFile
from Products.ERP5.Document.Document import ConversionError, NotConvertedError from erp5.component.document.Document import ConversionError, NotConvertedError
from Products.ERP5.mixin.base_extensible_traversable import BaseExtensibleTraversableMixin from Products.ERP5.mixin.base_extensible_traversable import BaseExtensibleTraversableMixin
from Products.ERP5.mixin.document_extensible_traversable import DocumentExtensibleTraversableMixin from Products.ERP5.mixin.document_extensible_traversable import DocumentExtensibleTraversableMixin
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
import urllib2 import urllib2
from lxml import etree from lxml import etree
from Products.ERP5.Document.Document import ConversionError from erp5.component.document.Document import ConversionError
SVG_DEFAULT_NAMESPACE = "http://www.w3.org/2000/svg" SVG_DEFAULT_NAMESPACE = "http://www.w3.org/2000/svg"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
from Products.PortalTransforms.interfaces import ITransform from Products.PortalTransforms.interfaces import ITransform
from zope.interface import implements from zope.interface import implements
from Products.ERP5.Document.Document import DocumentConversionServerProxy, ConversionError, enc, dec from erp5.component.document.Document import DocumentConversionServerProxy, ConversionError, enc, dec
class DocumentConversionServerTransform: class DocumentConversionServerTransform:
""" """
Transformer using Conversion Server Transformer using Conversion Server
......
...@@ -18,7 +18,7 @@ from cStringIO import StringIO ...@@ -18,7 +18,7 @@ from cStringIO import StringIO
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Base import removeIContentishInterface from Products.ERP5Type.Base import removeIContentishInterface
from Products.ERP5.Document.File import File, _MARKER from erp5.component.document.File import File, _MARKER
from Products.ERP5Type.BTreeData import BTreeData from Products.ERP5Type.BTreeData import BTreeData
from ZPublisher.HTTPRequest import FileUpload from ZPublisher.HTTPRequest import FileUpload
from ZPublisher import HTTPRangeSupport from ZPublisher import HTTPRangeSupport
......
...@@ -6291,59 +6291,6 @@ class TestBusinessTemplate(BusinessTemplateMixin): ...@@ -6291,59 +6291,6 @@ class TestBusinessTemplate(BusinessTemplateMixin):
""") """)
sequence_list.play(self) sequence_list.play(self)
def test_167_InstanceAndRelatedClassDefinedInSameBT(self):
# This test does too much since we don't modify objects anymore during
# download. Objects are cleaned up during installation, which does not
# require any specific action about garbage collection or pickle cache.
from Products.ERP5.Document.BusinessTemplate import BaseTemplateItem
portal = self.portal
BaseTemplateItem_removeProperties = BaseTemplateItem.removeProperties
object_id_list = 'old_file', 'some_file'
marker_list = []
def removeProperties(self, obj, export):
# Check it works if the object is modified during install.
if obj.id in object_id_list:
obj.int_index = marker_list.pop()
return obj
import Products.ERP5.tests
try:
BaseTemplateItem.removeProperties = removeProperties
template_tool = portal.portal_templates
bt_path = os.path.join(os.path.dirname(Products.ERP5.tests.__file__),
'test_data',
'test_167_InstanceAndRelatedClassDefinedInSameBT')
# create a previously existing instance of the overriden document type
File = portal.portal_types.getPortalTypeClass('File')
portal._setObject('another_file', File('another_file'))
self.tic()
# logged errors could keep a reference to a traceback having a reference
# to 'another_file' object
self.logged = []
# check its class has not yet been overriden
self.assertFalse(getattr(portal.another_file, 'isClassOverriden', False))
for i in (0, 1):
marker_list += [i] * len(object_id_list)
gc.disable()
bt = template_tool.download(bt_path)
assert marker_list
if i:
self.tic()
bt.install(force=1)
assert not marker_list
gc.enable()
for id in object_id_list:
self.assertEqual(getattr(portal, id).int_index, i)
self.tic()
finally:
BaseTemplateItem.removeProperties = BaseTemplateItem_removeProperties
gc.enable()
# check the previously existing instance now behaves as the overriden class
self.assertTrue(getattr(portal.another_file, 'isClassOverriden', False))
# test uninstall is effective
self.uninstallBusinessTemplate('test_167_InstanceAndRelatedClassDefinedInSameBT')
# check both File instances no longer behave like being overriden
self.assertFalse(getattr(portal.another_file, 'isClassOverriden', False))
def test_168_CheckPortalTypeAndPathInSameBusinessTemplate(self, change_broken_object=False): def test_168_CheckPortalTypeAndPathInSameBusinessTemplate(self, change_broken_object=False):
""" """
Make sure we can define a portal type and instance of that portal type Make sure we can define a portal type and instance of that portal type
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
# Cloudooo uses zip= argument, which is also a python builtin # Cloudooo uses zip= argument, which is also a python builtin
# pylint: disable=redefined-builtin # pylint: disable=redefined-builtin
from Products.ERP5.Document.Document import DocumentConversionServerProxy from erp5.component.document.Document import DocumentConversionServerProxy
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
from zExceptions import Unauthorized from zExceptions import Unauthorized
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.mixin.url import UrlMixin from erp5.component.mixin.UrlMixin import UrlMixin
from Products.ERP5.mixin.crawlable import CrawlableMixin from erp5.component.mixin.CrawlableMixin import CrawlableMixin
class ExternalSource(XMLObject, UrlMixin, CrawlableMixin): class ExternalSource(XMLObject, UrlMixin, CrawlableMixin):
""" """
......
...@@ -34,7 +34,7 @@ from AccessControl import ClassSecurityInfo ...@@ -34,7 +34,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from erp5.component.interface.IWatermarkable import IWatermarkable from erp5.component.interface.IWatermarkable import IWatermarkable
from erp5.component.document.Image import Image from erp5.component.document.Image import Image
from Products.ERP5.Document.Document import ConversionError from erp5.component.document.Document import ConversionError
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from zLOG import LOG, INFO, PROBLEM from zLOG import LOG, INFO, PROBLEM
import errno import errno
......
from Products.ERP5.Document.Document import ConversionError from erp5.component.document.Document import ConversionError
from erp5.component.module.Log import log from erp5.component.module.Log import log
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from xmlrpclib import Fault from xmlrpclib import Fault
......
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
from Products.ERP5.Document.Document import ConversionError from erp5.component.document.Document import ConversionError
from erp5.component.module.Log import log from erp5.component.module.Log import log
message = None message = None
......
# this script has an `format` argument # this script has an `format` argument
# pylint: disable=redefined-builtin # pylint: disable=redefined-builtin
from Products.ERP5.Document.Document import VALID_IMAGE_FORMAT_LIST from erp5.component.document.Document import VALID_IMAGE_FORMAT_LIST
if format in VALID_IMAGE_FORMAT_LIST: if format in VALID_IMAGE_FORMAT_LIST:
# we do not have any data so we can allow conversion to proceed and lead to a # we do not have any data so we can allow conversion to proceed and lead to a
......
...@@ -59,7 +59,7 @@ from Products.ERP5Type.tests.utils import DummyLocalizer ...@@ -59,7 +59,7 @@ from Products.ERP5Type.tests.utils import DummyLocalizer
from Products.ERP5OOo.OOoUtils import OOoBuilder from Products.ERP5OOo.OOoUtils import OOoBuilder
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from Products.ERP5.Document.Document import NotConvertedError from erp5.component.document.Document import NotConvertedError
from Products.ERP5Form.PreferenceTool import Priority from Products.ERP5Form.PreferenceTool import Priority
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.ERP5Type.Globals import get_request from Products.ERP5Type.Globals import get_request
......
...@@ -42,7 +42,7 @@ from AccessControl.SecurityManagement import newSecurityManager ...@@ -42,7 +42,7 @@ from AccessControl.SecurityManagement import newSecurityManager
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import FileUpload, createZODBPythonScript from Products.ERP5Type.tests.utils import FileUpload, createZODBPythonScript
from Products.ERP5.Document.Document import ConversionError from erp5.component.document.Document import ConversionError
from PIL import Image from PIL import Image
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.File import File, _MARKER from erp5.component.document.File import File, _MARKER
from ZPublisher import HTTPRangeSupport from ZPublisher import HTTPRangeSupport
from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator
from Products.CMFCore.utils import _checkConditionalGET from Products.CMFCore.utils import _checkConditionalGET
......
...@@ -64,7 +64,7 @@ class OAuthTool(BaseTool): ...@@ -64,7 +64,7 @@ class OAuthTool(BaseTool):
InitializeClass(OAuthTool) InitializeClass(OAuthTool)
import sys import sys
sys.modules['Products.ERP5TioSafe.Tool.OAuthTool'] = sys.modules[__name__] sys.modules['erp5.component.tool.OAuthTool'] = sys.modules[__name__]
Please register or sign in to reply
class DummyClassForUnpickle(object): class DummyClassForUnpickle(object):
def __init__(self, *_, **__): def __init__(self, *_, **__):
pass pass
......
...@@ -66,7 +66,6 @@ from Products.ERP5Type.dynamic.lazy_class import ERP5BaseBroken ...@@ -66,7 +66,6 @@ from Products.ERP5Type.dynamic.lazy_class import ERP5BaseBroken
from Products.ERP5Type.dynamic.portal_type_class import synchronizeDynamicModules from Products.ERP5Type.dynamic.portal_type_class import synchronizeDynamicModules
from Products.ERP5Type.Core.PropertySheet import PropertySheet as PropertySheetDocument from Products.ERP5Type.Core.PropertySheet import PropertySheet as PropertySheetDocument
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5.Document.File import File
from OFS.Traversable import NotFound from OFS.Traversable import NotFound
from OFS import SimpleItem, XMLExportImport from OFS import SimpleItem, XMLExportImport
from OFS.Image import Pdata from OFS.Image import Pdata
...@@ -1520,7 +1519,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -1520,7 +1519,7 @@ class ObjectTemplateItem(BaseTemplateItem):
container.getParentValue().updateCache() container.getParentValue().updateCache()
elif obj.__class__.__name__ in ('File', 'Image'): elif obj.__class__.__name__ in ('File', 'Image'):
if "data" in obj.__dict__: if "data" in obj.__dict__:
File._setData.__func__(obj, obj.data) obj._setData(obj.data)
  • Can this be the cause for ERP5.CodingStyleTest-Master erp5_officejs failure ? It started to fail in 1937c097...7c72a354

    That test complain because https://lab.nexedi.com/nexedi/erp5/blob/7c72a3547026b9e8594e2e67a457a3db9b5b2c62/bt5/erp5_officejs/PathTemplateItem/document_module/gadget_field_graph_interface_html_schema_json.bin is no longer exported with .bin extension but .json. I supposed that's better as .json

  • I will investigate this failure and let you know.

  • Thanks, it's better we understand why this has changed, even if the change at the end looks good.

    this might be because of an interaction workflow ( bt5/erp5_base/WorkflowTemplateItem/portal_workflow/document_conversion_interaction_workflow/scripts/Document_guessMimeType.py ? )

  • I investigated: I didn't notice but erp5.portal_type.File has _setData() because of document_conversion_interaction_workflow (Document_file interaction calling Document_guessMimeType) and this sets gadget_field_graph_interface_html_schema_json content_type to application/json (instead of text/json as defined in its XML).

    Edited by Arnaud Fontaine
  • Thanks ! Now, I wonder what's the best thing to do. If I understand correctly, now the file is modified at import time. When we import a business template with a file, the import will recaclulate the content type and maybe set to something different. Is it a problem ?

    This code was introduced in eaf027b2 , we did File._setData.__func__(obj, obj.data) and not just obj._setData(obj.data) maybe this is so that interaction do not happen ( @jm ? )

    could we keep this behavior by something like this ?

    from erp5.component.document.File import File
    ...
    File._setData.__func__(obj, obj.data)
  • The reason why I moved _setData() is because we cannot import erp5.component.document.File there as this is a chicken & egg issue (we need File ZODB Component which is not already installed/upgraded). If the Interaction Workflow being called is wrong here, then we can just do the same as before by calling OFS.Image.File._setData() (or the monkey patch directly).

  • Ah yes of course, we cannot import dynamic modules yet here. Now that the logic is monkey patched in OFS.Image.File._setData, that could be a way

  • Sorry to ask again, @jm do you remember why we did File._setData.__func__(obj, obj.data) and not just obj._setData(obj.data) ? We still have failing tests on master waiting for this. Or maybe we should revert ?

  • No point in reverting as the fix is simple. The question is rather if there is any reason to not call obj._setData()...

Please register or sign in to reply
elif (container.meta_type == 'CMF Skins Tool') and \ elif (container.meta_type == 'CMF Skins Tool') and \
(old_obj is not None): (old_obj is not None):
# Keep compatibility with previous export format of # Keep compatibility with previous export format of
...@@ -6548,7 +6547,6 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -6548,7 +6547,6 @@ Business Template is a set of definitions, such as skins, portal types and categ
# Business Template # Business Template
'Products.ERP5.Document.TrashBin', 'Products.ERP5.Document.TrashBin',
'Products.ERP5.Tool.TrashTool', 'Products.ERP5.Tool.TrashTool',
'Products.ERP5.Document.File',
'Products.ERP5.Document.PythonScript', 'Products.ERP5.Document.PythonScript',
'Products.ERP5.Document.BusinessTemplate', 'Products.ERP5.Document.BusinessTemplate',
'Products.ERP5.Tool.TemplateTool', 'Products.ERP5.Tool.TemplateTool',
......
...@@ -42,7 +42,6 @@ from Products.ERP5Type.Tool.BaseTool import BaseTool ...@@ -42,7 +42,6 @@ from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Type.Utils import reencodeUrlEscapes from Products.ERP5Type.Utils import reencodeUrlEscapes
from Products.ERP5 import _dtmldir from Products.ERP5 import _dtmldir
from Products.ERP5.mixin.url import no_crawl_protocol_list
from Products.ERP5Type.Utils import fill_args_from_request from Products.ERP5Type.Utils import fill_args_from_request
from AccessControl import Unauthorized from AccessControl import Unauthorized
...@@ -563,6 +562,7 @@ class ContributionTool(BaseTool): ...@@ -563,6 +562,7 @@ class ContributionTool(BaseTool):
if depth < 0: if depth < 0:
# Do nothing if crawling depth is reached # Do nothing if crawling depth is reached
return return
from erp5.component.mixin.UrlMixin import no_crawl_protocol_list
for url in set(content.getContentNormalisedURLList()): for url in set(content.getContentNormalisedURLList()):
# LOG('trying to crawl', 0, url) # LOG('trying to crawl', 0, url)
# Some url protocols should not be crawled # Some url protocols should not be crawled
......
...@@ -33,7 +33,7 @@ from AccessControl import ClassSecurityInfo ...@@ -33,7 +33,7 @@ from AccessControl import ClassSecurityInfo
from Acquisition import aq_base from Acquisition import aq_base
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from Products.CMFCore.utils import _checkPermission from Products.CMFCore.utils import _checkPermission
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.Utils import deprecated, guessEncodingFromText from Products.ERP5Type.Utils import deprecated, guessEncodingFromText
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
...@@ -41,16 +41,18 @@ from Products.ERP5.Tool.ContributionTool import MAX_REPEAT ...@@ -41,16 +41,18 @@ from Products.ERP5.Tool.ContributionTool import MAX_REPEAT
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery
from AccessControl import Unauthorized from AccessControl import Unauthorized
import zope.interface import zope.interface
from Products.PythonScripts.Utility import allow_class from AccessControl import allow_module, allow_class
# Mixin Import # Mixin Import
from Products.ERP5.mixin.cached_convertable import CachedConvertableMixin from erp5.component.mixin.CachedConvertableMixin import CachedConvertableMixin
from Products.ERP5.mixin.text_convertable import TextConvertableMixin from erp5.component.mixin.TextConvertableMixin import TextConvertableMixin
from Products.ERP5.mixin.downloadable import DownloadableMixin from erp5.component.mixin.DownloadableMixin import DownloadableMixin
from Products.ERP5.mixin.document import DocumentMixin from erp5.component.mixin.DocumentMixin import DocumentMixin
from Products.ERP5.mixin.crawlable import CrawlableMixin from erp5.component.mixin.CrawlableMixin import CrawlableMixin
from Products.ERP5.mixin.discoverable import DiscoverableMixin from erp5.component.mixin.DiscoverableMixin import DiscoverableMixin
from Products.ERP5.mixin.url import UrlMixin from erp5.component.mixin.UrlMixin import UrlMixin
allow_module(__name__)
_MARKER = object() _MARKER = object()
...@@ -73,6 +75,7 @@ DEFAULT_IMAGE_QUALITY = 75.0 ...@@ -73,6 +75,7 @@ DEFAULT_IMAGE_QUALITY = 75.0
DEFAULT_CONTENT_TYPE = 'text/html' DEFAULT_CONTENT_TYPE = 'text/html'
class ConversionError(Exception):pass class ConversionError(Exception):pass
allow_class(ConversionError)
class DocumentProxyError(Exception):pass class DocumentProxyError(Exception):pass
...@@ -90,7 +93,6 @@ global_server_proxy_uri_failure_time = {} ...@@ -90,7 +93,6 @@ global_server_proxy_uri_failure_time = {}
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from functools import partial from functools import partial
from xmlrpclib import Fault, ServerProxy, ProtocolError from xmlrpclib import Fault, ServerProxy, ProtocolError
from AccessControl import Unauthorized
from socket import error as SocketError from socket import error as SocketError
from DateTime import DateTime from DateTime import DateTime
class DocumentConversionServerProxy(): class DocumentConversionServerProxy():
...@@ -169,7 +171,7 @@ class DocumentConversionServerProxy(): ...@@ -169,7 +171,7 @@ class DocumentConversionServerProxy():
if not(failure): if not(failure):
try: try:
response_code, response_dict, response_message = result_set response_code, _, _ = result_set
except ValueError: except ValueError:
# Compatibility for old oood, result is based type, like string # Compatibility for old oood, result is based type, like string
response_code = 200 response_code = 200
...@@ -207,7 +209,16 @@ class DocumentConversionServerProxy(): ...@@ -207,7 +209,16 @@ class DocumentConversionServerProxy():
return partial(self._proxy_function, attr) return partial(self._proxy_function, attr)
from Products.ERP5.mixin.document_extensible_traversable import DocumentExtensibleTraversableMixin from Products.ERP5.mixin.document_extensible_traversable import DocumentExtensibleTraversableMixin
from erp5.component.interface.IConvertable import IConvertable
from erp5.component.interface.ITextConvertable import ITextConvertable
from erp5.component.interface.IHtmlConvertable import IHtmlConvertable
from erp5.component.interface.ICachedConvertable import ICachedConvertable
from erp5.component.interface.IVersionable import IVersionable
from erp5.component.interface.IDownloadable import IDownloadable
from erp5.component.interface.ICrawlable import ICrawlable
from erp5.component.interface.IDocument import IDocument
from erp5.component.interface.IDiscoverable import IDiscoverable
from erp5.component.interface.IUrl import IUrl
class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin, class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
CachedConvertableMixin, CrawlableMixin, TextConvertableMixin, CachedConvertableMixin, CrawlableMixin, TextConvertableMixin,
DownloadableMixin, DocumentMixin, DiscoverableMixin): DownloadableMixin, DocumentMixin, DiscoverableMixin):
...@@ -380,27 +391,27 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin, ...@@ -380,27 +391,27 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
isDocument = ConstantGetter('isDocument', value=True) isDocument = ConstantGetter('isDocument', value=True)
__dav_collection__=0 __dav_collection__=0
zope.interface.implements(interfaces.IConvertable, zope.interface.implements(IConvertable,
interfaces.ITextConvertable, ITextConvertable,
interfaces.IHtmlConvertable, IHtmlConvertable,
interfaces.ICachedConvertable, ICachedConvertable,
interfaces.IVersionable, IVersionable,
interfaces.IDownloadable, IDownloadable,
interfaces.ICrawlable, ICrawlable,
interfaces.IDocument, IDocument,
interfaces.IDiscoverable, IDiscoverable,
interfaces.IUrl, IUrl,
) )
# Regular expressions # Regular expressions
# XXX those regex are weak, fast but not reliable. # XXX those regex are weak, fast but not reliable.
# this is a valid url than regex are not able to parse # this is a valid url than regex are not able to parse
# http://www.example.com//I don't care i put what/ i want/ # http://www.example.com//I don't care i put what/ i want/
href_parser = re.compile('<a[^>]*href=[\'"](.*?)[\'"]',re.IGNORECASE) href_parser = re.compile(r'<a[^>]*href=[\'"](.*?)[\'"]',re.IGNORECASE)
body_parser = re.compile('<body[^>]*>(.*?)</body>', re.IGNORECASE + re.DOTALL) body_parser = re.compile(r'<body[^>]*>(.*?)</body>', re.IGNORECASE + re.DOTALL)
title_parser = re.compile('<title[^>]*>(.*?)</title>', re.IGNORECASE + re.DOTALL) title_parser = re.compile(r'<title[^>]*>(.*?)</title>', re.IGNORECASE + re.DOTALL)
base_parser = re.compile('<base[^>]*href=[\'"](.*?)[\'"][^>]*>', re.IGNORECASE + re.DOTALL) base_parser = re.compile(r'<base[^>]*href=[\'"](.*?)[\'"][^>]*>', re.IGNORECASE + re.DOTALL)
charset_parser = re.compile('(?P<keyword>charset="?)(?P<charset>[a-z0-9\-]+)', re.IGNORECASE) charset_parser = re.compile(r'(?P<keyword>charset="?)(?P<charset>[a-z0-9\-]+)', re.IGNORECASE)
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
...@@ -772,7 +783,7 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin, ...@@ -772,7 +783,7 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
group_by=('language',)) group_by=('language',))
if version is not None: if version is not None:
kw['version'] = version kw['version'] = version
return map(lambda o:o.getLanguage(), catalog(**kw)) return [o.getLanguage() for o in catalog(**kw)]
security.declareProtected(Permissions.AccessContentsInformation, 'getOriginalLanguage') security.declareProtected(Permissions.AccessContentsInformation, 'getOriginalLanguage')
def getOriginalLanguage(self): def getOriginalLanguage(self):
...@@ -836,7 +847,7 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin, ...@@ -836,7 +847,7 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
is the one to override in subclasses. is the one to override in subclasses.
""" """
kw['format'] = 'html' kw['format'] = 'html'
mime, html = self.convert(**kw) _, html = self.convert(**kw)
return html return html
security.declareProtected(Permissions.View, 'asStrippedHTML') security.declareProtected(Permissions.View, 'asStrippedHTML')
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Document Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>Document</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Document.Document</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.Document</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Document Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -33,7 +33,7 @@ from AccessControl import ClassSecurityInfo ...@@ -33,7 +33,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from erp5.component.document.TextDocument import TextDocument from erp5.component.document.TextDocument import TextDocument
from Products.ERP5.Document.File import File from erp5.component.document.File import File
from erp5.component.mixin.MailMessageMixin import MailMessageMixin, testCharsetAndConvert from erp5.component.mixin.MailMessageMixin import MailMessageMixin, testCharsetAndConvert
from erp5.component.mixin.DocumentProxyMixin import DocumentProxyMixin, DocumentProxyError from erp5.component.mixin.DocumentProxyMixin import DocumentProxyMixin, DocumentProxyError
from MethodObject import Method from MethodObject import Method
......
...@@ -30,13 +30,11 @@ ...@@ -30,13 +30,11 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Base import WorkflowMethod from Products.ERP5Type.Base import WorkflowMethod
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.Document import Document, VALID_TEXT_FORMAT_LIST from erp5.component.document.Document import Document, VALID_TEXT_FORMAT_LIST
from Products.ERP5.Document.Document import VALID_IMAGE_FORMAT_LIST from erp5.component.document.Document import VALID_IMAGE_FORMAT_LIST
from Products.ERP5.Document.Document import ConversionError from erp5.component.document.Document import ConversionError
from Products.ERP5Type.Base import Base, removeIContentishInterface from Products.ERP5Type.Base import Base, removeIContentishInterface
from Products.CMFDefault.File import File as CMFFile from Products.CMFDefault.File import File as CMFFile
from OFS.Image import Pdata
from cStringIO import StringIO
from Products.ERP5Type.Utils import deprecated from Products.ERP5Type.Utils import deprecated
def _unpackData(data): def _unpackData(data):
...@@ -129,7 +127,7 @@ class File(Document, CMFFile): ...@@ -129,7 +127,7 @@ class File(Document, CMFFile):
security.declareProtected(Permissions.View, 'getcontentlength') security.declareProtected(Permissions.View, 'getcontentlength')
getcontentlength = get_size getcontentlength = get_size
def _get_content_type(*args, **kw): def _get_content_type(self, *_, **__):
"""Override original implementation from OFS/Image.py """Override original implementation from OFS/Image.py
to disable content_type discovery because to disable content_type discovery because
id of object its used to read the filename value. id of object its used to read the filename value.
...@@ -167,20 +165,6 @@ class File(Document, CMFFile): ...@@ -167,20 +165,6 @@ class File(Document, CMFFile):
return self.getPortalObject().portal_contributions.\ return self.getPortalObject().portal_contributions.\
guessMimeTypeFromFilename(fname) guessMimeTypeFromFilename(fname)
security.declareProtected(Permissions.ModifyPortalContent, '_setData')
def _setData(self, data):
"""
"""
# update_data use len(data) when size is None, which breaks this method.
# define size = 0 will prevent len be use and keep the consistency of
# getData() and setData()
if data is None:
size = 0
else:
data, size = self._read_data(data)
# We call this method to make sure size is set and caches reset
self.update_data(data, size=size)
security.declareProtected(Permissions.AccessContentsInformation, 'getData') security.declareProtected(Permissions.AccessContentsInformation, 'getData')
def getData(self, default=None): def getData(self, default=None):
"""return Data as str.""" """return Data as str."""
...@@ -229,7 +213,7 @@ class File(Document, CMFFile): ...@@ -229,7 +213,7 @@ class File(Document, CMFFile):
return (mime_type, content) return (mime_type, content)
def _convert(self, format, **kw): def _convert(self, format, **kw): # pylint: disable=redefined-builtin
"""File is only convertable if it is an image. """File is only convertable if it is an image.
Only Image conversion, original format and text formats are allowed. Only Image conversion, original format and text formats are allowed.
However this document can migrate to another portal_type which support However this document can migrate to another portal_type which support
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Document Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>File</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Document.File</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.File</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Document Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -31,15 +31,15 @@ from AccessControl.ZopeGuards import guarded_getattr ...@@ -31,15 +31,15 @@ from AccessControl.ZopeGuards import guarded_getattr
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.Document import Document, ConversionError, _MARKER, DEFAULT_CONTENT_TYPE from erp5.component.document.Document import Document, ConversionError, _MARKER, DEFAULT_CONTENT_TYPE
from Products.ERP5.Document.File import File from erp5.component.document.File import File
from erp5.component.module.WebDAVSupport import TextContent from erp5.component.module.WebDAVSupport import TextContent
from Products.ERP5.Document.Document import VALID_IMAGE_FORMAT_LIST, VALID_TEXT_FORMAT_LIST from erp5.component.document.Document import VALID_IMAGE_FORMAT_LIST, VALID_TEXT_FORMAT_LIST
import cStringIO import cStringIO
from string import Template from string import Template
# Mixin Import # Mixin Import
from Products.ERP5.mixin.cached_convertable import CachedConvertableMixin from erp5.component.mixin.CachedConvertableMixin import CachedConvertableMixin
from erp5.component.mixin.BaseConvertableFileMixin import BaseConvertableFileMixin from erp5.component.mixin.BaseConvertableFileMixin import BaseConvertableFileMixin
from Products.ERP5Type.mixin.text_content_history import TextContentHistoryMixin from Products.ERP5Type.mixin.text_content_history import TextContentHistoryMixin
from Products.ERP5Type.Utils import guessEncodingFromText from Products.ERP5Type.Utils import guessEncodingFromText
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ICachedConvertable</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.cached_convertable</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.ICachedConvertable</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.interfaces.format_convertable import IFormatConvertable from erp5.component.interface.IFormatConvertable import IFormatConvertable
class IConvertable(IFormatConvertable): class IConvertable(IFormatConvertable):
""" """
...@@ -37,7 +37,7 @@ class IConvertable(IFormatConvertable): ...@@ -37,7 +37,7 @@ class IConvertable(IFormatConvertable):
to multiple formats. to multiple formats.
""" """
def convert(format, **kw): def convert(format, **kw): # pylint: disable=redefined-builtin
""" """
Converts the current document to the specified format Converts the current document to the specified format
taking into account optional parameters. This method taking into account optional parameters. This method
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>IConvertable</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.convertable</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.IConvertable</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ICrawlable</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.crawlable</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.ICrawlable</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>IDiscoverable</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.discoverable</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.IDiscoverable</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
# #
############################################################################## ##############################################################################
""" """
Products.ERP5.interfaces.document erp5.component.interface.IDocument
""" """
from zope.interface import Interface from zope.interface import Interface
...@@ -185,7 +185,7 @@ class IDocument(Interface): ...@@ -185,7 +185,7 @@ class IDocument(Interface):
(title). Each change generates a new revision. (title). Each change generates a new revision.
""" """
def convert(format, **kw): def convert(format, **kw): # pylint: disable=redefined-builtin
"""Call a wrapped function with CachingMethod and """Call a wrapped function with CachingMethod and
return always converted result: ie. tuple(content_type, data) return always converted result: ie. tuple(content_type, data)
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>IDocument</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.document</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.IDocument</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -37,7 +37,7 @@ class IDownloadable(Interface): ...@@ -37,7 +37,7 @@ class IDownloadable(Interface):
directly from their URL using any format specified as a parameter. directly from their URL using any format specified as a parameter.
""" """
def index_html(REQUEST, RESPONSE, format=None, **kw): def index_html(REQUEST, RESPONSE, format=None, **kw): # pylint: disable=redefined-builtin
""" """
Download the document in the specified format with Download the document in the specified format with
optional conversion parameters. optional conversion parameters.
...@@ -52,7 +52,7 @@ class IDownloadable(Interface): ...@@ -52,7 +52,7 @@ class IDownloadable(Interface):
kw -- optional conversion parameters kw -- optional conversion parameters
""" """
def getStandardFilename(format=None): def getStandardFilename(format=None): # pylint: disable=redefined-builtin
""" """
Returns a standard file name for the document to download. Returns a standard file name for the document to download.
This method is the reverse of This method is the reverse of
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>IDownloadable</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.downloadable</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.IDownloadable</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -37,7 +37,7 @@ class IFormatConvertable(Interface): ...@@ -37,7 +37,7 @@ class IFormatConvertable(Interface):
be converted to. be converted to.
""" """
def isTargetFormatAllowed(format): def isTargetFormatAllowed(format): # pylint: disable=redefined-builtin
""" """
Checks if the current document can be converted Checks if the current document can be converted
to the specified target format. to the specified target format.
...@@ -47,7 +47,7 @@ class IFormatConvertable(Interface): ...@@ -47,7 +47,7 @@ class IFormatConvertable(Interface):
string (ex. 'text/plain') string (ex. 'text/plain')
""" """
def isTargetFormatPermitted(format): def isTargetFormatPermitted(format): # pylint: disable=redefined-builtin
""" """
Checks if the current user can convert the current Checks if the current user can convert the current
document to the specified target format. document to the specified target format.
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>IFormatConvertable</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.format_convertable</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.IFormatConvertable</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>IHtmlConvertable</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.html_convertable</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.IHtmlConvertable</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.interfaces.text_convertable_legacy import ITextConvertableLegacy from erp5.component.interface.ITextConvertableLegacy import ITextConvertableLegacy
class ITextConvertable(ITextConvertableLegacy): class ITextConvertable(ITextConvertableLegacy):
""" """
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ITextConvertable</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.text_convertable</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.ITextConvertable</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ITextConvertableLegacy</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.text_convertable_legacy</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.ITextConvertableLegacy</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>IUrl</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.url</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.IUrl</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interface Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>IVersionable</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.interfaces.versionable</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interface.erp5.IVersionable</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interface Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -275,7 +275,7 @@ class CachedConvertableMixin: ...@@ -275,7 +275,7 @@ class CachedConvertableMixin:
""" """
Returns a list of acceptable formats for conversion Returns a list of acceptable formats for conversion
""" """
return map(lambda x: x[0], self.getTargetFormatItemList()) return [x[0] for x in self.getTargetFormatItemList()]
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getTargetFormatList') 'getTargetFormatList')
...@@ -283,11 +283,11 @@ class CachedConvertableMixin: ...@@ -283,11 +283,11 @@ class CachedConvertableMixin:
""" """
Returns a list of acceptable formats for conversion Returns a list of acceptable formats for conversion
""" """
return map(lambda x: x[1], self.getTargetFormatItemList()) return [x[1] for x in self.getTargetFormatItemList()]
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.ModifyPortalContent,
'isTargetFormatAllowed') 'isTargetFormatAllowed')
def isTargetFormatAllowed(self, format): def isTargetFormatAllowed(self, format): # pylint: disable=redefined-builtin
""" """
Checks if the current document can be converted Checks if the current document can be converted
into the specified target format. into the specified target format.
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Mixin Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>CachedConvertableMixin</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.mixin.cached_convertable</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>mixin.erp5.CachedConvertableMixin</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Mixin Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -106,7 +106,7 @@ class CrawlableMixin: ...@@ -106,7 +106,7 @@ class CrawlableMixin:
if base_href: if base_href:
html_tree.make_links_absolute(base_href) html_tree.make_links_absolute(base_href)
href_list = [] href_list = []
for elemnt, attribute_name, link, position in html_tree.iterlinks(): for _, attribute_name, link, _ in html_tree.iterlinks():
# For now take into acount only a and img tags # For now take into acount only a and img tags
if attribute_name not in ('href',): if attribute_name not in ('href',):
continue continue
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Mixin Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>CrawlableMixin</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.mixin.crawlable</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>mixin.erp5.CrawlableMixin</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Mixin Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -33,7 +33,7 @@ from ZODB.POSException import ConflictError ...@@ -33,7 +33,7 @@ from ZODB.POSException import ConflictError
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
from Products.ERP5.mixin.cached_convertable import CachedConvertableMixin from erp5.component.mixin.CachedConvertableMixin import CachedConvertableMixin
import os import os
import re import re
...@@ -82,7 +82,7 @@ class DiscoverableMixin(CachedConvertableMixin): ...@@ -82,7 +82,7 @@ class DiscoverableMixin(CachedConvertableMixin):
returns properties which should be set on the document returns properties which should be set on the document
""" """
# accesss data through convert # accesss data through convert
mime, content = self.convert(None) _, content = self.convert(None)
if not content: if not content:
# if document is empty, we will not find anything in its content # if document is empty, we will not find anything in its content
return {} return {}
...@@ -235,7 +235,7 @@ class DiscoverableMixin(CachedConvertableMixin): ...@@ -235,7 +235,7 @@ class DiscoverableMixin(CachedConvertableMixin):
""" """
if not filename: if not filename:
filename = self.getStandardFilename() filename = self.getStandardFilename()
basename, extension = os.path.splitext(filename) _, extension = os.path.splitext(filename)
if extension: if extension:
extension = extension[1:].lower() # remove first dot extension = extension[1:].lower() # remove first dot
return extension return extension
...@@ -247,14 +247,14 @@ class DiscoverableMixin(CachedConvertableMixin): ...@@ -247,14 +247,14 @@ class DiscoverableMixin(CachedConvertableMixin):
Call private implementation, then store the result in conversion Call private implementation, then store the result in conversion
cache storage. cache storage.
""" """
format = CONTENT_INFORMATION_FORMAT format_ = CONTENT_INFORMATION_FORMAT
# How to knows if a instance implement an interface # How to knows if a instance implement an interface
try: try:
mime, cached_value = self.getConversion(format=format) _, cached_value = self.getConversion(format=format_)
return cached_value return cached_value
except KeyError: except KeyError:
value = self._getContentInformation() value = self._getContentInformation()
self.setConversion(value, format=format) self.setConversion(value, format=format_)
return value return value
def _getContentInformation(self): def _getContentInformation(self):
...@@ -269,7 +269,7 @@ class DiscoverableMixin(CachedConvertableMixin): ...@@ -269,7 +269,7 @@ class DiscoverableMixin(CachedConvertableMixin):
html = self.asEntireHTML() html = self.asEntireHTML()
except ConflictError: except ConflictError:
raise raise
except: except Exception:
return result return result
if not html: if not html:
return result return result
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Mixin Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>DiscoverableMixin</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.mixin.discoverable</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>mixin.erp5.DiscoverableMixin</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Mixin Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -29,11 +29,8 @@ ...@@ -29,11 +29,8 @@
from AccessControl import ClassSecurityInfo, Unauthorized from AccessControl import ClassSecurityInfo, Unauthorized
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from OFS.Image import Pdata
from cStringIO import StringIO
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
_MARKER = []
LOCK_PERMISSION_KEY = 'TRANSACTIONAL_VARIABLE_FORMAT_PERMISSION_LOCK_FLAG' LOCK_PERMISSION_KEY = 'TRANSACTIONAL_VARIABLE_FORMAT_PERMISSION_LOCK_FLAG'
class DocumentMixin: class DocumentMixin:
...@@ -50,7 +47,7 @@ class DocumentMixin: ...@@ -50,7 +47,7 @@ class DocumentMixin:
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareProtected(Permissions.AccessContentsInformation, 'convert') security.declareProtected(Permissions.AccessContentsInformation, 'convert')
def convert(self, format, **kw): def convert(self, format, **kw): # pylint: disable=redefined-builtin
""" """
Main content conversion function, returns result which should Main content conversion function, returns result which should
be returned and stored in cache. be returned and stored in cache.
...@@ -94,7 +91,7 @@ class DocumentMixin: ...@@ -94,7 +91,7 @@ class DocumentMixin:
fallback_script_id='Document_getFailsafeConversion') fallback_script_id='Document_getFailsafeConversion')
return method(**kw) return method(**kw)
def _convert(self, format, **kw): def _convert(self, format, **kw): # pylint: disable=redefined-builtin
"""Private method which make the transformation. """Private method which make the transformation.
Must be overriden !!! Must be overriden !!!
""" """
...@@ -102,7 +99,7 @@ class DocumentMixin: ...@@ -102,7 +99,7 @@ class DocumentMixin:
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'checkConversionFormatPermission') 'checkConversionFormatPermission')
def checkConversionFormatPermission(self, format, **kw): def checkConversionFormatPermission(self, format, **kw): # pylint: disable=redefined-builtin
"""Public version of _checkConversionFormatPermission """Public version of _checkConversionFormatPermission
Without raising return just True or False. Without raising return just True or False.
""" """
...@@ -113,7 +110,7 @@ class DocumentMixin: ...@@ -113,7 +110,7 @@ class DocumentMixin:
else: else:
return True return True
def _checkConversionFormatPermission(self, format, lock_checking=False, **kw): def _checkConversionFormatPermission(self, format, lock_checking=False, **kw): # pylint: disable=redefined-builtin
"""Private method to check permission when access specified format. """Private method to check permission when access specified format.
This method raises This method raises
""" """
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Mixin Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>DocumentMixin</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.mixin.document</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>mixin.erp5.DocumentMixin</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Mixin Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
from AccessControl import ClassSecurityInfo, Unauthorized from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
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
...@@ -35,7 +35,7 @@ from Products.CMFCore.utils import getToolByName, _checkConditionalGET, _setCach ...@@ -35,7 +35,7 @@ from Products.CMFCore.utils import getToolByName, _checkConditionalGET, _setCach
import warnings import warnings
from zExceptions import Forbidden from zExceptions import Forbidden
_MARKER = [] _MARKER = object()
class DownloadableMixin: class DownloadableMixin:
security = ClassSecurityInfo() security = ClassSecurityInfo()
...@@ -43,7 +43,7 @@ class DownloadableMixin: ...@@ -43,7 +43,7 @@ class DownloadableMixin:
### Content processing methods ### Content processing methods
security.declareProtected(Permissions.View, 'index_html') security.declareProtected(Permissions.View, 'index_html')
@fill_args_from_request('display', 'quality', 'resolution', 'frame', 'pre_converted_only') @fill_args_from_request('display', 'quality', 'resolution', 'frame', 'pre_converted_only')
def index_html(self, REQUEST, RESPONSE, format=_MARKER, inline=_MARKER, **kw): def index_html(self, REQUEST, RESPONSE, format=_MARKER, inline=_MARKER, **kw): # pylint: disable=redefined-builtin
""" """
We follow here the standard Zope API for files and images We follow here the standard Zope API for files and images
and extend it to support format conversion. The idea and extend it to support format conversion. The idea
...@@ -66,7 +66,7 @@ class DownloadableMixin: ...@@ -66,7 +66,7 @@ class DownloadableMixin:
**kw -- can be various things - e.g. resolution **kw -- can be various things - e.g. resolution
""" """
from Products.ERP5.Document.Document import VALID_TEXT_FORMAT_LIST,\ from erp5.component.document.Document import VALID_TEXT_FORMAT_LIST,\
VALID_IMAGE_FORMAT_LIST VALID_IMAGE_FORMAT_LIST
if format is _MARKER and not kw: if format is _MARKER and not kw:
# conversion parameters is mandatory to download the converted content. # conversion parameters is mandatory to download the converted content.
...@@ -133,7 +133,7 @@ class DownloadableMixin: ...@@ -133,7 +133,7 @@ class DownloadableMixin:
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getStandardFilename') 'getStandardFilename')
def getStandardFilename(self, format=None): def getStandardFilename(self, format=None): # pylint: disable=redefined-builtin
"""Returns the document coordinates as a standard file name. This """Returns the document coordinates as a standard file name. This
method is the reverse of getPropertyDictFromFileName. method is the reverse of getPropertyDictFromFileName.
""" """
...@@ -153,7 +153,7 @@ class DownloadableMixin: ...@@ -153,7 +153,7 @@ class DownloadableMixin:
# backward compatibility # backward compatibility
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getStandardFileName') 'getStandardFileName')
def getStandardFileName(self, format=None): def getStandardFileName(self, format=None): # pylint: disable=redefined-builtin
"""(deprecated) use getStandardFilename() instead.""" """(deprecated) use getStandardFilename() instead."""
warnings.warn('getStandardFileName() is deprecated. ' warnings.warn('getStandardFileName() is deprecated. '
'use getStandardFilename() instead.') 'use getStandardFilename() instead.')
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Mixin Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>DownloadableMixin</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.mixin.downloadable</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>mixin.erp5.DownloadableMixin</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Mixin Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -47,7 +47,7 @@ class TextConvertableMixin: ...@@ -47,7 +47,7 @@ class TextConvertableMixin:
Converts the current document to plain text Converts the current document to plain text
""" """
kw.pop('format', None) kw.pop('format', None)
mime, data = self.convert(format='txt', **kw) _, data = self.convert(format='txt', **kw)
return str(data) return str(data)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
...@@ -57,7 +57,7 @@ class TextConvertableMixin: ...@@ -57,7 +57,7 @@ class TextConvertableMixin:
Converts the current document to plain text without substitution Converts the current document to plain text without substitution
""" """
kw.pop('format', None) kw.pop('format', None)
mime, data = self.convert(format='txt', substitute=False, **kw) _, data = self.convert(format='txt', substitute=False, **kw)
return str(data) return str(data)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Mixin Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>TextConvertableMixin</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.mixin.text_convertable</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>mixin.erp5.TextConvertableMixin</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Mixin Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Mixin Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>UrlMixin</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.mixin.url</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>mixin.erp5.UrlMixin</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Mixin Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
containing searched words as well highlighting the searched containing searched words as well highlighting the searched
words in the text itself. words in the text itself.
""" """
from Products.ERP5.Document.Document import NotConvertedError from erp5.component.document.Document import NotConvertedError
encoding = 'utf-8' encoding = 'utf-8'
is_gadget_mode = context.REQUEST.get('is_gadget_mode', 0) is_gadget_mode = context.REQUEST.get('is_gadget_mode', 0)
......
...@@ -6,7 +6,7 @@ style = request.get('your_portal_skin', ...@@ -6,7 +6,7 @@ style = request.get('your_portal_skin',
item_list = [('', '')] item_list = [('', '')]
from Products.ERP5.Document.Document import ConversionError from erp5.component.document.Document import ConversionError
try: try:
if style == 'ODS': if style == 'ODS':
......
...@@ -7,9 +7,11 @@ document.erp5.ContributionPredicate ...@@ -7,9 +7,11 @@ document.erp5.ContributionPredicate
document.erp5.Delivery document.erp5.Delivery
document.erp5.DeliveryCell document.erp5.DeliveryCell
document.erp5.DeliveryLine document.erp5.DeliveryLine
document.erp5.Document
document.erp5.DomainGenerator document.erp5.DomainGenerator
document.erp5.EmailDocument document.erp5.EmailDocument
document.erp5.Event document.erp5.Event
document.erp5.File
document.erp5.ImmobilisableItem document.erp5.ImmobilisableItem
document.erp5.ImmobilisationDelivery document.erp5.ImmobilisationDelivery
document.erp5.ImmobilisationMovement document.erp5.ImmobilisationMovement
......
...@@ -11,16 +11,24 @@ interface.erp5.IArrowBase ...@@ -11,16 +11,24 @@ interface.erp5.IArrowBase
interface.erp5.IAssetMovement interface.erp5.IAssetMovement
interface.erp5.IBaseConvertable interface.erp5.IBaseConvertable
interface.erp5.IBusinessProcess interface.erp5.IBusinessProcess
interface.erp5.ICachedConvertable
interface.erp5.IConvertable
interface.erp5.ICrawlable
interface.erp5.IDiscoverable
interface.erp5.IDivergenceController interface.erp5.IDivergenceController
interface.erp5.IDivergenceTester interface.erp5.IDivergenceTester
interface.erp5.IDocument
interface.erp5.IDocumentProxy interface.erp5.IDocumentProxy
interface.erp5.IDownloadable
interface.erp5.IEntity interface.erp5.IEntity
interface.erp5.IExpandable interface.erp5.IExpandable
interface.erp5.IExplainable interface.erp5.IExplainable
interface.erp5.IExtensibleTraversable interface.erp5.IExtensibleTraversable
interface.erp5.IFile interface.erp5.IFile
interface.erp5.IFormatConvertable
interface.erp5.IGeneratedDeliveryBuilder interface.erp5.IGeneratedDeliveryBuilder
interface.erp5.IGranulatable interface.erp5.IGranulatable
interface.erp5.IHtmlConvertable
interface.erp5.IImmobilisationItem interface.erp5.IImmobilisationItem
interface.erp5.IMappedValue interface.erp5.IMappedValue
interface.erp5.IMimeSender interface.erp5.IMimeSender
...@@ -38,6 +46,10 @@ interface.erp5.ISendable ...@@ -38,6 +46,10 @@ interface.erp5.ISendable
interface.erp5.ISimilarityProvider interface.erp5.ISimilarityProvider
interface.erp5.ISimulatedDeliveryBuilder interface.erp5.ISimulatedDeliveryBuilder
interface.erp5.ISimulationMovement interface.erp5.ISimulationMovement
interface.erp5.ITextConvertable
interface.erp5.ITextConvertableLegacy
interface.erp5.ITextDocument interface.erp5.ITextDocument
interface.erp5.ITranslatable interface.erp5.ITranslatable
interface.erp5.IUploadable interface.erp5.IUploadable
interface.erp5.IUrl
interface.erp5.IVersionable
\ No newline at end of file
mixin.erp5.AmountGeneratorMixin mixin.erp5.AmountGeneratorMixin
mixin.erp5.BaseConvertableFileMixin mixin.erp5.BaseConvertableFileMixin
mixin.erp5.CachedConvertableMixin
mixin.erp5.CompositionMixin mixin.erp5.CompositionMixin
mixin.erp5.CrawlableMixin
mixin.erp5.DiscoverableMixin
mixin.erp5.DocumentMixin
mixin.erp5.DocumentProxyMixin mixin.erp5.DocumentProxyMixin
mixin.erp5.DownloadableMixin
mixin.erp5.ExplainableMixin mixin.erp5.ExplainableMixin
mixin.erp5.MailMessageMixin mixin.erp5.MailMessageMixin
mixin.erp5.MovementCollectionUpdaterMixin mixin.erp5.MovementCollectionUpdaterMixin
mixin.erp5.MovementGeneratorMixin mixin.erp5.MovementGeneratorMixin
mixin.erp5.RuleMixin mixin.erp5.RuleMixin
mixin.erp5.SimulableMixin mixin.erp5.SimulableMixin
mixin.erp5.TextConvertableMixin
mixin.erp5.UrlMixin
mixin.erp5.VirtualFolderMixin mixin.erp5.VirtualFolderMixin
\ No newline at end of file
...@@ -49,9 +49,9 @@ implements_tuple_list = [ ...@@ -49,9 +49,9 @@ implements_tuple_list = [
(('erp5.component.document.Transformation','Transformation'), 'IVariated'), (('erp5.component.document.Transformation','Transformation'), 'IVariated'),
(('erp5.component.document.TransformedResource','TransformedResource'), 'IVariated'), (('erp5.component.document.TransformedResource','TransformedResource'), 'IVariated'),
#IDocument #IDocument
(('Products.ERP5.Document.Document', 'Document'), 'IDocument'), (('erp5.component.document.Document', 'Document'), 'IDocument'),
(('erp5.component.document.Image', 'Image'), 'IDocument'), (('erp5.component.document.Image', 'Image'), 'IDocument'),
(('Products.ERP5.Document.File', 'File'), 'IDocument'), (('erp5.component.document.File', 'File'), 'IDocument'),
(('erp5.component.document.OOoDocument', 'OOoDocument'), 'IDocument'), (('erp5.component.document.OOoDocument', 'OOoDocument'), 'IDocument'),
(('erp5.component.document.TextDocument', 'TextDocument'), 'IDocument'), (('erp5.component.document.TextDocument', 'TextDocument'), 'IDocument'),
(('erp5.component.document.EmailDocument', 'EmailDocument'), 'IDocument'), (('erp5.component.document.EmailDocument', 'EmailDocument'), 'IDocument'),
......
...@@ -441,7 +441,7 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -441,7 +441,7 @@ Hé Hé Hé!""", page.asText().strip())
# and make sure that the base meta tag which is generated # and make sure that the base meta tag which is generated
# uses the web section rather than the portal # uses the web section rather than the portal
html_page = websection() html_page = websection()
from Products.ERP5.Document.Document import Document from erp5.component.document.Document import Document
base_list = re.findall(Document.base_parser, str(html_page)) base_list = re.findall(Document.base_parser, str(html_page))
base_url = base_list[0] base_url = base_list[0]
self.assertEqual(base_url, "%s/%s/" % (websection.absolute_url(), self.assertEqual(base_url, "%s/%s/" % (websection.absolute_url(),
...@@ -478,7 +478,7 @@ Hé Hé Hé!""", page.asText().strip()) ...@@ -478,7 +478,7 @@ Hé Hé Hé!""", page.asText().strip())
# and make sure that the base meta tag which is generated # and make sure that the base meta tag which is generated
# uses the web site rather than the portal # uses the web site rather than the portal
html_page = website() html_page = website()
from Products.ERP5.Document.Document import Document from erp5.component.document.Document import Document
base_list = re.findall(Document.base_parser, str(html_page)) base_list = re.findall(Document.base_parser, str(html_page))
base_url = base_list[0] base_url = base_list[0]
self.assertEqual(base_url, "%s/%s/" % (website.absolute_url(), web_page_en.getReference())) self.assertEqual(base_url, "%s/%s/" % (website.absolute_url(), web_page_en.getReference()))
......
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Products.ERP5Type.XMLObject import XMLObject
class File(XMLObject):
portal_type = 'File'
isClassOverriden = True
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="File" module="Products.ERP5Type.Document.File"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>old_file</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>some_file</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>Foo Type</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Type</string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>ERP5TypeInformation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Foo Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>Foo</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Foo Type</string> </value>
</item>
<item>
<key> <string>type_class</string> </key>
<value> <string>XMLObject</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test_167_InstanceAndRelatedClassDefinedInSameBT
\ No newline at end of file
...@@ -34,7 +34,6 @@ from Products.Formulator.DummyField import fields ...@@ -34,7 +34,6 @@ from Products.Formulator.DummyField import fields
from Products.Formulator.Field import ZMIField from Products.Formulator.Field import ZMIField
from Selection import Selection from Selection import Selection
from Products.ERP5Type.Globals import get_request from Products.ERP5Type.Globals import get_request
from Products.ERP5.Document.Document import VALID_IMAGE_FORMAT_LIST
from zLOG import LOG from zLOG import LOG
...@@ -475,6 +474,7 @@ class OOoChartWidget(Widget.Widget): ...@@ -475,6 +474,7 @@ class OOoChartWidget(Widget.Widget):
# not editable (otherwise, REQUEST.form may contain listbox=()). # not editable (otherwise, REQUEST.form may contain listbox=()).
url = '%s/%s/%s?%s' % (here.absolute_url(), form.getId(), field.getId(), url = '%s/%s/%s?%s' % (here.absolute_url(), form.getId(), field.getId(),
make_query(query_dict)) make_query(query_dict))
from erp5.component.document.Document import VALID_IMAGE_FORMAT_LIST
if format in VALID_IMAGE_FORMAT_LIST: if format in VALID_IMAGE_FORMAT_LIST:
return '''<div class="OOoChartContent"> return '''<div class="OOoChartContent">
<img class="%s" src="%s" title="%s" alt="%s"/"> <img class="%s" src="%s" title="%s" alt="%s"/">
......
...@@ -34,7 +34,6 @@ from Testing import ZopeTestCase ...@@ -34,7 +34,6 @@ from Testing import ZopeTestCase
from Products.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
from Acquisition import aq_base from Acquisition import aq_base
from Products.ERP5Type.Globals import get_request from Products.ERP5Type.Globals import get_request
from Products.ERP5.Document.Document import VALID_IMAGE_FORMAT_LIST
from lxml import etree from lxml import etree
HTTP_OK = 200 HTTP_OK = 200
...@@ -178,6 +177,7 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -178,6 +177,7 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional):
# Test the differents render # Test the differents render
# render image # render image
from erp5.component.document.Document import VALID_IMAGE_FORMAT_LIST
for image_format in VALID_IMAGE_FORMAT_LIST: for image_format in VALID_IMAGE_FORMAT_LIST:
response = self.publish( response = self.publish(
'/%s/%s/%s?render_format=%s&display=medium' '/%s/%s/%s?render_format=%s&display=medium'
...@@ -271,6 +271,7 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -271,6 +271,7 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional):
# Test the differents render # Test the differents render
# render image # render image
from erp5.component.document.Document import VALID_IMAGE_FORMAT_LIST
for image_format in VALID_IMAGE_FORMAT_LIST: for image_format in VALID_IMAGE_FORMAT_LIST:
response = self.publish( response = self.publish(
'/%s/%s/%s?render_format=%s&display=medium' '/%s/%s/%s?render_format=%s&display=medium'
......
...@@ -286,7 +286,7 @@ class FormPrintout(Implicit, Persistent, RoleManager, Item, PropertyManager): ...@@ -286,7 +286,7 @@ class FormPrintout(Implicit, Persistent, RoleManager, Item, PropertyManager):
# XXX This is a temporary implementation: # XXX This is a temporary implementation:
# Calling a webservice must be done through a WebServiceMethod # Calling a webservice must be done through a WebServiceMethod
# and a WebServiceConnection # and a WebServiceConnection
from Products.ERP5.Document.Document import DocumentConversionServerProxy, enc, dec from erp5.component.document.Document import DocumentConversionServerProxy, enc, dec
server_proxy = DocumentConversionServerProxy(self) server_proxy = DocumentConversionServerProxy(self)
extension = guess_extension(content_type).strip('.') extension = guess_extension(content_type).strip('.')
printout = dec(server_proxy.convertFile(enc(printout), printout = dec(server_proxy.convertFile(enc(printout),
......
...@@ -53,7 +53,6 @@ try: ...@@ -53,7 +53,6 @@ try:
except ImportError: except ImportError:
SUPPORTS_WEBDAV_LOCKS = 0 SUPPORTS_WEBDAV_LOCKS = 0
from Products.ERP5.Document.Document import ConversionError
from Products.Formulator.Widget import convert_to_xml_compatible_string from Products.Formulator.Widget import convert_to_xml_compatible_string
from lxml import etree from lxml import etree
from lxml.etree import Element from lxml.etree import Element
......
...@@ -64,6 +64,5 @@ def initialize( context ): ...@@ -64,6 +64,5 @@ def initialize( context ):
# allow import of various exceptions in restricted environment # allow import of various exceptions in restricted environment
# so we can catch them in ZODB scripts and inform user nicely # so we can catch them in ZODB scripts and inform user nicely
allow_module('Products.ERP5.Document.Document.ConversionError')
allow_module('xmlrpclib.Fault') allow_module('xmlrpclib.Fault')
allow_module('socket.error') allow_module('socket.error')
...@@ -31,7 +31,6 @@ import os ...@@ -31,7 +31,6 @@ import os
import unittest import unittest
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5.Document.Document import ConversionError
class TestOoodResponse(ERP5TypeTestCase): class TestOoodResponse(ERP5TypeTestCase):
...@@ -110,6 +109,7 @@ class TestOoodResponse(ERP5TypeTestCase): ...@@ -110,6 +109,7 @@ class TestOoodResponse(ERP5TypeTestCase):
ERP5Site_viewNothingAsOdt = self.getPortal().ERP5Site_viewNothingAsOdt ERP5Site_viewNothingAsOdt = self.getPortal().ERP5Site_viewNothingAsOdt
# This assumes that a conversion error is raised because oood coordinates # This assumes that a conversion error is raised because oood coordinates
# are not defined in preferences. # are not defined in preferences.
from erp5.component.document.Document import ConversionError
self.assertRaises(ConversionError, ERP5Site_viewNothingAsOdt, self.assertRaises(ConversionError, ERP5Site_viewNothingAsOdt,
batch_mode=0, format='pdf') batch_mode=0, format='pdf')
self.assertEqual('text/html', self.assertEqual('text/html',
...@@ -121,6 +121,7 @@ class TestOoodResponse(ERP5TypeTestCase): ...@@ -121,6 +121,7 @@ class TestOoodResponse(ERP5TypeTestCase):
ERP5Site_viewNothingAsOdt = self.getPortal().ERP5Site_viewNothingAsOdt ERP5Site_viewNothingAsOdt = self.getPortal().ERP5Site_viewNothingAsOdt
# This assumes that a conversion error is raised because oood coordinates # This assumes that a conversion error is raised because oood coordinates
# are not defined in preferences. # are not defined in preferences.
from erp5.component.document.Document import ConversionError
self.assertRaises(ConversionError, ERP5Site_viewNothingAsOdt, self.assertRaises(ConversionError, ERP5Site_viewNothingAsOdt,
batch_mode=1, format='pdf') batch_mode=1, format='pdf')
self.assertEqual('text/html', request.RESPONSE.getHeader('content-type').split(';')[0]) self.assertEqual('text/html', request.RESPONSE.getHeader('content-type').split(';')[0])
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from Products.PortalTransforms.libtransforms.commandtransform import commandtransform from Products.PortalTransforms.libtransforms.commandtransform import commandtransform
from Products.PortalTransforms.interfaces import idatastream from Products.PortalTransforms.interfaces import idatastream
from Products.ERP5.Document.Document import ConversionError from erp5.component.document.Document import ConversionError
from Acquisition import aq_base from Acquisition import aq_base
from zope.interface import implements from zope.interface import implements
from OFS.Image import Image as OFSImage from OFS.Image import Image as OFSImage
...@@ -17,11 +17,6 @@ from lxml.etree import SubElement ...@@ -17,11 +17,6 @@ from lxml.etree import SubElement
from urllib import unquote from urllib import unquote
from urlparse import parse_qsl, urlparse from urlparse import parse_qsl, urlparse
# XXX Must be replaced by portal_data_adapters soon
from Products.ERP5.Document.Document import DocumentConversionServerProxy
from Products.ERP5.Document.Document import enc
from Products.ERP5.Document.Document import dec
def includeMetaContentType(html_node): def includeMetaContentType(html_node):
"""XXX Temp workaround time to fix issue """XXX Temp workaround time to fix issue
in lxml when include_meta_content_type is not honoured in lxml when include_meta_content_type is not honoured
...@@ -220,11 +215,17 @@ class OOOdCommandTransform(commandtransform): ...@@ -220,11 +215,17 @@ class OOOdCommandTransform(commandtransform):
return xml_output return xml_output
def convertTo(self, format): def convertTo(self, format):
# XXX Must be replaced by portal_data_adapters soon
from erp5.component.document.Document import DocumentConversionServerProxy
server_proxy = DocumentConversionServerProxy(self.context) server_proxy = DocumentConversionServerProxy(self.context)
response_code, response_dict, message = \ response_code, response_dict, message = \
server_proxy.getAllowedTargetItemList(self.mimetype) server_proxy.getAllowedTargetItemList(self.mimetype)
allowed_extension_list = response_dict['response_data'] allowed_extension_list = response_dict['response_data']
if format in dict(allowed_extension_list): if format in dict(allowed_extension_list):
# XXX Must be replaced by portal_data_adapters soon
from erp5.component.document.Document import enc, dec
response_code, response_dict, message = server_proxy.run_generate( response_code, response_dict, message = server_proxy.run_generate(
'', '',
enc(self.data), enc(self.data),
......
...@@ -2540,7 +2540,7 @@ class Base( ...@@ -2540,7 +2540,7 @@ class Base(
# CMF 2.x. They use aliases and Zope3 style views now and make pretty sure # CMF 2.x. They use aliases and Zope3 style views now and make pretty sure
# not to let zpublisher reach this value. # not to let zpublisher reach this value.
index_html = None index_html = None
# By the Way, Products.ERP5.Document.File and .Image define their own # By the Way, erp5.component.document.File and .Image define their own
# index_html to make sure this value here is not used so that they're # index_html to make sure this value here is not used so that they're
# downloadable by their naked URL. # downloadable by their naked URL.
......
...@@ -1650,7 +1650,7 @@ def legacyNormalizeUrl(url, base_url=None): ...@@ -1650,7 +1650,7 @@ def legacyNormalizeUrl(url, base_url=None):
"""this method does normalisation itself. """this method does normalisation itself.
The result is less reliable but better than nothing The result is less reliable but better than nothing
""" """
from Products.ERP5.mixin.url import no_host_protocol_list from erp5.component.mixin.UrlMixin import no_host_protocol_list
# remove anchors # remove anchors
# http://www.example.com/page.html#ll -> http://www.example.com/page.html # http://www.example.com/page.html#ll -> http://www.example.com/page.html
url = re_cleanup_anchors.sub('', url) url = re_cleanup_anchors.sub('', url)
......
...@@ -16,3 +16,19 @@ File.manage_editForm = manage_editForm ...@@ -16,3 +16,19 @@ File.manage_editForm = manage_editForm
# restore __repr__ after persistent > 4.4 # restore __repr__ after persistent > 4.4
# https://github.com/zopefoundation/Zope/issues/379 # https://github.com/zopefoundation/Zope/issues/379
File.__repr__ = Item.__repr__ File.__repr__ = Item.__repr__
def _setData(self, data):
"""
Originally from Document class. Added because it is used by
BusinessTemplate on OFS.Image.{File,Image} instances
"""
# update_data use len(data) when size is None, which breaks this method.
# define size = 0 will prevent len be use and keep the consistency of
# getData() and setData()
if data is None:
size = 0
else:
data, size = self._read_data(data)
# We call this method to make sure size is set and caches reset
self.update_data(data, size=size)
File._setData = _setData
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment