Commit 27355069 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

PortalTransforms: refresh transforms in internal structure in reloadTransforms().

parent e29ba689
...@@ -31,6 +31,7 @@ from Products.PortalTransforms.utils import TransformException ...@@ -31,6 +31,7 @@ from Products.PortalTransforms.utils import TransformException
from Products.PortalTransforms.utils import _www from Products.PortalTransforms.utils import _www
from ZODB.POSException import ConflictError
from zLOG import WARNING from zLOG import WARNING
class TransformTool(UniqueObject, ActionProviderBase, Folder): class TransformTool(UniqueObject, ActionProviderBase, Folder):
...@@ -546,6 +547,18 @@ class TransformTool(UniqueObject, ActionProviderBase, Folder): ...@@ -546,6 +547,18 @@ class TransformTool(UniqueObject, ActionProviderBase, Folder):
o = getattr(self, id) o = getattr(self, id)
o.reload() o.reload()
reloaded.append((id, o.module)) reloaded.append((id, o.module))
try:
self._unmapTransform(o)
except ConflictError:
raise
except:
  • @kazuhiko this looks dangerous. Can't we use a more specific exception or something that would not hide unrelated errors ?

  • Is the following fine ?

    --- a/product/PortalTransforms/TransformEngine.py
    +++ b/product/PortalTransforms/TransformEngine.py
    @@ -13,6 +13,7 @@ from Products.CMFCore.ActionProviderBase import ActionProviderBase
     from Products.CMFCore.permissions import ManagePortal, View
     from Products.CMFCore.utils import registerToolInterface, UniqueObject
     from Products.CMFCore.utils import getToolByName
    +from Products.MimetypesRegistry.common import MimeTypeException
     from Products.PageTemplates.PageTemplateFile import PageTemplateFile
     
     from Products.PortalTransforms.data import datastream
    @@ -549,15 +550,11 @@ class TransformTool(UniqueObject, ActionProviderBase, Folder):
                 reloaded.append((id, o.module))
                 try:
                     self._unmapTransform(o)
    -            except ConflictError:
    -                raise
    -            except:
    +            except MimeTypeException:
                     pass
                 try:
                     self._mapTransform(o)
    -            except ConflictError:
    -                raise
    -            except:
    +            except MimeTypeException:
                     pass
             return reloaded
     
  • @kazuhiko thanks, this looks fine.

Please register or sign in to reply
pass
try:
self._mapTransform(o)
except ConflictError:
raise
except:
pass
return reloaded return reloaded
# Policy handling methods # Policy handling methods
......
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