Skip to content

Instantly share code, notes, and snippets.

@rbanffy
Created August 28, 2012 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbanffy/3498636 to your computer and use it in GitHub Desktop.
Save rbanffy/3498636 to your computer and use it in GitHub Desktop.
@@ -10,14 +10,17 @@ from collective.transmogrifier.utils import defaultMatcher
from OFS.interfaces import IPropertyManager
from Products.GenericSetup.utils import PropertyManagerHelpers, NodeAdapterBase
+import logging
+logger = logging.getLogger('quintagroup.transmogrifier.propertymanager')
+
class Helper(PropertyManagerHelpers, NodeAdapterBase):
""" We need this class because PropertyManagerHelpers in _initProperties
method uses _convertToBoolean and _getNodeText methods from
NodeAdapterBase class.
"""
-
+
_encoding = 'utf-8'
-
+
def __init__(self):
pass
@@ -98,7 +101,10 @@ class Helper(PropertyManagerHelpers, NodeAdapterBase):
obj._setProperty(prop_id, val, prop_type)
prop_map = obj.propdict().get(prop_id, None)
else:
- raise ValueError("undefined property '%s'" % prop_id)
+ # import ipdb; ipdb.set_trace()
+ logging.warn("undefined property '%s' of '%s'" % (prop_id, obj.__repr__()))
+ continue
+ # raise ValueError("undefined property '%s'" % prop_id)
if not 'w' in prop_map.get('mode', 'wd'):
raise BadRequest('%s cannot be changed' % prop_id)
@@ -154,7 +160,7 @@ class PropertiesExporterSection(object):
self.fileskey = options.get('files-key', '_files').strip()
self.excludekey = defaultMatcher(options, 'exclude-key', name, 'excluded_properties')
- self.exclude = filter(None, [i.strip() for i in
+ self.exclude = filter(None, [i.strip() for i in
options.get('exclude', '').splitlines()])
self.helper = Helper()
@@ -216,7 +222,7 @@ class PropertiesImporterSection(object):
self.fileskey = defaultMatcher(options, 'files-key', name, 'files')
self.excludekey = defaultMatcher(options, 'exclude-key', name, 'excluded_properties')
- self.exclude = filter(None, [i.strip() for i in
+ self.exclude = filter(None, [i.strip() for i in
options.get('exclude', '').splitlines()])
self.helper = Helper()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment