def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = defaultMatcher(options, 'files-key', name, 'files') self.purge = options.get('purge', 'false').strip().lower() == 'true' and True or False
def __init__(self, transmogrifier, name, options, previous): self.fileskey = defaultMatcher(options, 'files-key', name, 'files') self.source = options.get('source', 'marshall').strip() self.fromkey = defaultMatcher(options, 'from-key', name, 'from') self.tokey = defaultMatcher(options, 'to-key', name, 'to') self.previous = previous
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.wftool = getToolByName(self.context, "portal_workflow") self.pathkey = defaultMatcher(options, "path-key", name, "path") self.transitionskey = defaultMatcher(options, "transitions-key", name, "transitions")
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = defaultMatcher(options, 'files-key', name, 'files') if 'prefix' in options: self.prefix = options['prefix'].strip() else: self.prefix = '' context_type = options.get('context', 'tarball').strip() setup_tool = utils.getToolByName(self.context, 'portal_setup') if context_type == 'directory': profile_path = options.get('path', '') self.export_context = context.DirectoryExportContext( setup_tool, profile_path) elif context_type == 'tarball': self.export_context = context.TarballExportContext(setup_tool) elif context_type == 'snapshot': items = ('snapshot', ) + time.gmtime()[:6] snapshot_id = '%s-%4d%02d%02d%02d%02d%02d' % items self.export_context = context.SnapshotExportContext( setup_tool, snapshot_id) else: self.export_context = context.TarballExportContext(setup_tool)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.typekey = defaultMatcher(options, 'type-key', name, 'type', ('portal_type', 'Type')) self.pathkey = defaultMatcher(options, 'path-key', name, 'path')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = defaultMatcher(options, 'files-key', name, 'files') self.contextkey = defaultMatcher(options, 'context-key', name, 'import_context')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = defaultMatcher(options, 'files-key', name, 'files') if 'prefix' in options: self.prefix = options['prefix'].strip() else: self.prefix = '' context_type = options.get('context', 'tarball').strip() setup_tool = utils.getToolByName(self.context, 'portal_setup') if context_type == 'directory': profile_path = options.get('path', '') self.export_context = context.DirectoryExportContext(setup_tool, profile_path) elif context_type == 'tarball': self.export_context = context.TarballExportContext(setup_tool) elif context_type == 'snapshot': items = ('snapshot',) + time.gmtime()[:6] snapshot_id = '%s-%4d%02d%02d%02d%02d%02d' % items self.export_context = context.SnapshotExportContext(setup_tool, snapshot_id) else: self.export_context = context.TarballExportContext(setup_tool)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.layoutkey = defaultMatcher(options, 'layout-key', name, 'layout') self.defaultpagekey = defaultMatcher(options, 'default-page-key', name,'defaultpage') self.is_defaultpagekey = defaultMatcher(options, 'is-default-page-key', name,'is_defaultpage')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.wftool = getToolByName(self.context, 'portal_workflow') self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.transitionskey = defaultMatcher(options, 'transitions-key', name, 'transitions')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = defaultMatcher(options, 'files-key', name, 'files') self.dtool = utils.getToolByName(self.context, 'portal_discussion')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.layoutkey = defaultMatcher(options, 'layout-key', name, 'layout') self.defaultpagekey = defaultMatcher(options, 'default-page-key', name, 'defaultpage')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.criterionkey = defaultMatcher(options, 'criterion-key', name, 'criterion') self.fieldkey = defaultMatcher(options, 'field-key', name, 'field')
def __init__(self, transmogrifier, name, options, previous): self.every = int(options.get('every', 1000)) self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.poskey = defaultMatcher(options, 'pos-key', name, 'gopip') # Position of items without a position value self.default_pos = int(options.get('default-pos', 1000000))
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.ttool = api.portal.get_tool(name='portal_types') self.typekey = defaultMatcher(options, 'type-key', name, 'type', ('portal_type', 'Type')) self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.required = bool(options.get('required'))
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, "path-key", name, "path") self.fileskey = defaultMatcher(options, "files-key", name, "files") self.contextkey = defaultMatcher(options, "context-key", name, "import_context") self.condition = Condition(options.get("condition", "python:True"), transmogrifier, name, options)
def __init__(self, transmogrifier, name, options, previous): self.transmogrifier = transmogrifier self.name = name self.options = options self.previous = previous self.context = transmogrifier.context self.datakey = defaultMatcher(options, self.key_option_name, name, self.default_key_name) self.pathkey = defaultMatcher(options, 'path-key', name, 'path')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.ttool = getToolByName(self.context, 'portal_types') self.typekey = defaultMatcher(options, 'type-key', name, 'type', ('portal_type', 'Type')) self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.required = bool(options.get('required'))
def __init__(self, transmogrifier, name, options, previous): self.transmogrifier = transmogrifier self.name = name self.options = options self.previous = previous self.context = transmogrifier.context self.datakey = defaultMatcher( options, self.key_option_name, name, self.default_key_name) self.pathkey = defaultMatcher(options, 'path-key', name, 'path')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.ttool = getToolByName(self.context, 'portal_types') self.typekey = defaultMatcher(options, 'type-key', name, 'type', ('portal_type', 'Type')) self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.meta_types = filter(None, [i.strip() for i in options.get('meta-types', '').splitlines()])
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.typekey = defaultMatcher(options, 'type-key', name, 'type', ('portal_type', 'Type')) self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.update = options.get('update', 'true').lower() in ( "yes", "true", "t", "1") self.required = bool(options.get('required'))
def __init__(self, transmogrifier, name, options, previous): self.transmogrifier = transmogrifier self.name = name self.options = options self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.constrainkey = defaultMatcher(options, 'constraintypes-key', name, 'constraintypes')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.typekey = defaultMatcher(options, 'type-key', name, 'type', ('portal_type', 'Type')) self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.update = options.get('update', 'true').lower() in ("yes", "true", "t", "1") self.required = bool(options.get('required'))
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.canonicalkey = defaultMatcher(options, 'canonical-key', name, 'canonicalTranslation') self.translationkey = defaultMatcher(options, 'translation-key', name, 'translationOf') self.deferred = []
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context #self.ttool = getToolByName(self.context, 'portal_types') self.typekey = defaultMatcher(options, 'type-key', name, 'type', ('portal_type', 'Type')) self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.target = options.get('target','http://localhost:8080/plone') self.target = self.target.rstrip('/')+'/'
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.canonicalkey = defaultMatcher(options, 'canonical-key', name, 'canonicalTranslation') self.translationkey = defaultMatcher(options, 'translation-key', name, 'translationOf') self.uuid_generator = getUtility(IUUIDGenerator) self.deferred = []
def readOptions(self, options): """ Read options give in pipeline.cfg """ # Call parent PathBasedAbstractRemoteCommand.readOptions(self, options) # Remote site / object URL containing HTTP Basic Auth username and password self.pathkey = defaultMatcher(options, 'path-key', self.name, 'path') self.transitionskey = defaultMatcher(options, 'transitions-key', self.name, 'transitions')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = defaultMatcher(options, 'files-key', name, 'files') self.contextkey = defaultMatcher(options, 'context-key', name, 'import_context') self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options)
def readOptions(self, options): """ Read options give in pipeline.cfg. """ # Call parent AbstractRemoteCommand.readOptions(self, options) # Remote site / object URL containing HTTP Basic Auth username and password self.pathkey = defaultMatcher(options, 'path-key', self.name, 'path') self.transitionskey = defaultMatcher(options, 'transitions-key', self.name, 'transitions')
def __init__(self, transmogrifier, name, options, previous): self.previous = TreeSerializer(transmogrifier, name, options, previous) self.context = transmogrifier.context # self.ttool = getToolByName(self.context, 'portal_types') self.typekey = defaultMatcher(options, "type-key", name, "type", ("portal_type", "Type", "_type")) self.pathkey = defaultMatcher(options, "path-key", name, "path") self.target = options.get("target", "") self.logger = logging.getLogger(name) if self.target: self.target = self.target.rstrip("/") + "/"
def __init__(self, transmogrifier, name, options, previous): self.previous = TreeSerializer(transmogrifier, name, options, previous) self.context = transmogrifier.context #self.ttool = getToolByName(self.context, 'portal_types') self.typekey = defaultMatcher(options, 'type-key', name, 'type', ('portal_type', 'Type','_type')) self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.target = options.get('target','') self.logger = logging.getLogger(name) if self.target: self.target = self.target.rstrip('/')+'/'
def __init__(self, transmogrifier, name, options, previous): self.transmogrifier = transmogrifier self.options = options self.previous = previous self.schemakey = defaultMatcher( options, 'schema-key', name, 'schemafields') self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.typekey = defaultMatcher(options, 'type-key', name, 'type', ('portal_type', 'Type')) self.anno = IAnnotations(transmogrifier) self.storage = self.anno.setdefault(CSV_KEY, {}) self.destination = self.options.get('destination', '/tmp')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = options.get('files-key', '_files').strip() self.excludekey = defaultMatcher(options, 'exclude-key', name, 'excluded_fields') self.exclude = filter(None, [i.strip() for i in options.get('exclude', '').splitlines()]) self.atxml = registry.getComponent("atxml")
def readOptions(self, options): """ Read options give in pipeline.cfg. """ # Call parent AbstractRemoteCommand.readOptions(self, options) # Remote site / object URL containing HTTP Basic Auth username and password. # Note: self.pathkey is a function self.pathkey = defaultMatcher(options, 'path-key', self.name, 'path') self.typekey = defaultMatcher(options, 'type-key', self.name, 'type', ('portal_type', 'Type','_type'))
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') 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 options.get('exclude', '').splitlines()]) helper_kwargs = options.get('helper_kwargs', {}) self.helper = Helper(**helper_kwargs)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = options.get('files-key', '_files').strip() self.excludekey = defaultMatcher(options, 'exclude-key', name, 'excluded_fields') self.exclude = filter( None, [i.strip() for i in options.get('exclude', '').splitlines()]) self.atxml = registry.getComponent("atxml")
def readOptions(self, options): """ Read options give in pipeline.cfg. """ # Call parent AbstractRemoteCommand.readOptions(self, options) # Remote site / object URL containing HTTP Basic Auth username and password. # Note: self.pathkey is a function self.pathkey = defaultMatcher(options, 'path-key', self.name, 'path') self.typekey = defaultMatcher(options, 'type-key', self.name, 'type', ('portal_type', 'Type', '_type'))
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = defaultMatcher(options, 'files-key', name, 'files') # Marshall doesn't support excluding fields on demarshalling, # we can do this with xml.dom.minodom, if it'll be needed in the future # self.excludekey = defaultMatcher(options, 'exclude-key', name, 'excluded_fields') # self.exclude = filter(None, [i.strip() for i in # options.get('exclude', '').splitlines()]) self.atxml = registry.getComponent("atxml")
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') 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 options.get('exclude', '').splitlines()]) self.helper = Helper() self.doc = etree.Element('properties') self.helper._doc = self.doc
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.name = name self.pathKey = defaultMatcher(options, 'path-key', name, 'path') self.originalPathKey = defaultMatcher(options, 'orig-path-key', name, 'orig_path') self.seen_count = self.changed_count = 0 self.portal_path = '/'.join(self.context.getPhysicalPath()) self.redirector = queryUtility(IRedirectionStorage) if self.redirector is None: log.error(u'No IRedirectionStorage found, ' u'skipping all redirections.')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') 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 options.get('exclude', '').splitlines()]) self.helper = Helper() self.helper._encoding = 'utf-8'
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.transmogrifier = transmogrifier self.flagkey = defaultMatcher(options, 'old-path-key', name, 'oldpath') self.typekey = defaultMatcher(options, 'type-key', name, 'type') self.pathkey = defaultMatcher(options, 'path-key', name, 'path') site_urls = options.get('site-urls', '') site_urls = filter(None, [i.strip() for i in site_urls.splitlines()]) for i in site_urls: SITE_URLS.append(i) self.anno = IAnnotations(transmogrifier)
def __init__(self, transmogrifier, name, options, previous): self.transmogrifier = transmogrifier self.name = name self.options = options self.previous = previous self.portal_path = make_path(transmogrifier.context) self.typekey = defaultMatcher(options, 'type-key', name, 'type', ('portal_type', 'Type')) self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.set_options() # FIXME: fixed logger key should be made generic. self.storage = IAnnotations(transmogrifier).setdefault( "sc.transmogrifier.utils.storage", {}) self.storage["logger"] = [] self.logger_ = self.storage["logger"]
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = defaultMatcher(options, 'files-key', name, 'files') self.typekey = options.get('type-key', '_type').strip() # communication with logger self.anno = IAnnotations(transmogrifier) self.storage = self.anno.setdefault(VALIDATIONKEY, []) # we need this dictionary to store manifest data, because reader section # uses recursion when walking through content folders self.manifests = {}
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.transmogrifier = transmogrifier self.key = defaultMatcher(options, 'key', name) self.filename = options.get('filename') if self.filename: self.filename = options['filename'] = self.filename self.rowkey = options.get('row-key') if 'row-key' in options: self.rowkey = Expression(self.rowkey, transmogrifier, name, options) self.rowvalue = Expression(options.get('row-value', 'filename'), transmogrifier, name, options) self.dialect = options.get('dialect', 'excel') self.restkey = options.get('restkey', '_csvsource_rest') self.fmtparam = dict((key[len('fmtparam-'):], Expression(value, transmogrifier, name, options)( options, key=key[len('fmtparam-'):])) for key, value in options.iteritems() if key.startswith('fmtparam-')) self.fieldnames = options.get('fieldnames') if self.fieldnames: self.fieldnames = self.fieldnames.split()
def __init__(self, transmogrifier, name, options, previous): """ """ self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.name = name self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = options.get('files-key', '_files').strip() self.disable_constraints = Expression( options.get('disable-constraints', 'python: False'), transmogrifier, name, options, ) # create logger if options.get('logger'): self.logger = logging.getLogger(options['logger']) self.loglevel = getattr(logging, options['loglevel'], None) if self.loglevel is None: # Assume it's an integer: self.loglevel = int(options['loglevel']) self.logger.setLevel(self.loglevel) self.log = lambda s: self.logger.log(self.loglevel, s) else: self.log = None self.errored = IAnnotations(transmogrifier).setdefault(ERROREDKEY, [])
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context if transmogrifier.context else getSite( ) # noqa self.name = name self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = options.get('files-key', '_files').strip() self.disable_constraints = Expression( options.get('disable-constraints', 'python: False'), transmogrifier, name, options, ) # if importing from collective.jsonify exported json structures, there # is an datafield entry for binary data, which' prefix can be # configured. self.datafield_prefix = options.get('datafield-prefix', '_datafield_') # create logger if options.get('logger'): self.logger = logging.getLogger(options['logger']) self.loglevel = getattr(logging, options['loglevel'], None) if self.loglevel is None: # Assume it's an integer: self.loglevel = int(options['loglevel']) self.logger.setLevel(self.loglevel) self.log = lambda s: self.logger.log(self.loglevel, s) else: self.log = None
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context if transmogrifier.context else getSite( ) # noqa self.name = name self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = options.get('files-key', '_files').strip()
def readOptions(self, options): """ Read options give in pipeline.cfg """ # Call parent PathBasedAbstractRemoteCommand.readOptions(self, options) # Which key we use to read navigation exclusion hint self.exclusion = defaultMatcher(options, 'exclude-from-navigation-key', self.name, 'exclude-from-navigation')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.fileskey = options.get('files-key', '_files').strip() self.doc = minidom.Document()
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.portal_catalog = transmogrifier.context.portal_catalog self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.verbose = options.get('verbose', '0').lower() in ('1', 'true', 'yes', 'on') self.counter = 0
def __init__(self, transmogrifier, name, options, previous): self.previous = TreeSerializer(transmogrifier, name, options, previous) self.context = transmogrifier.context #self.ttool = getToolByName(self.context, 'portal_types') self.typekey = defaultMatcher(options, 'type-key', name, 'type', ('portal_type', 'Type', '_type')) self.pathkey = defaultMatcher(options, 'path-key', name, 'path') self.creation_key = options.get('creation-key', '_creation_flag').strip() self.alias_key = options.get('alias-key', '_origin_path').strip() self.target = options.get('target','') self.logger = logging.getLogger(name) if self.target: self.target = self.target.rstrip('/')+'/' self.create=Condition(options.get('create-condition','python:True'), transmogrifier, name, options) self.move=Condition(options.get('move-condition','python:True'), transmogrifier, name, options) self.remove=Condition(options.get('remove-condition','python:True'), transmogrifier, name, options)