def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.portal = transmogrifier.context self.catalog = self.portal.portal_catalog self.storage = IAnnotations(transmogrifier).get(ANNOTATION_KEY) self.ids = self.storage['ids'] # we add in options the following information, used in imio.dms.mail context cbin = self.portal.portal_quickinstaller.isProductInstalled( 'collective.behavior.internalnumber') options['cbin'] = str(cbin) self.uniques = {} self.cbin_beh = {} for typ in MANAGED_TYPES: values = safe_unicode(options.get('{}_uniques'.format(typ), '')).strip().split() if len(values) % 4: raise Exception( "The '{}' section '{}' option must contain a multiple of 4 elements" .format(name, '{}_uniques'.format(typ))) self.uniques[typ] = [(f, i, Condition(c, transmogrifier, name, options), Condition(e, transmogrifier, name, options)) for f, i, c, e in by4wise(values)] typ_fti = getattr(self.portal.portal_types, typ) self.cbin_beh[typ] = 'collective.behavior.internalnumber.behavior.IInternalNumberBehavior' in \ typ_fti.behaviors self.roe = bool(int(options.get('raise_on_error', '1')))
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.relinker = Relinker(transmogrifier, name, options, self.tidy()) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.logger = logging.getLogger(name) self.options = options self.locale = getattr(options, 'locale', 'en') self.invalid_ids = options.get('invalid_ids', '').split() self.link_expr = None self.name = name self.logger = logging.getLogger(name) if options.get('link_expr', None): self.link_expr = Expression(options['link_expr'], transmogrifier, name, options) self.use_title = Condition(options.get('use_title', 'python:False'), transmogrifier, name, options) #util = queryUtility(IURLNormalizer) #if util: # self.normalize = util.normalize #else: self.locale = Expression(options.get('locale', 'python:None'), transmogrifier, name, options)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.relinker = Relinker(transmogrifier, '%s' % name, options, self.ouriter()) self.field_expr = Expression(options.get('field_expr', 'python:None'), transmogrifier, name, options) self.field = options.get('field', '').strip() self.breadcrumb_field = options.get('breadcrumb_field', '').strip() self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.logger = logging.getLogger(name) self.options = options # if set will ensure all sitemap items are of this type, using defaultpage if needed self.folder_type = options.get('folder-type', 'Folder').strip() self.convert_to_folders = False self.exclusion = options.get('exclude-from-navigation-key', 'exclude-from-navigation') self.title_key = options.get('title-key', 'title') self.post_sub = [ s.strip() for s in options.get( 'path_sub', options.get('post-sub', '')).split('\n') if s.strip() ] self.name = name self.logger = logging.getLogger(name)
def __init__(self, transmogrifier, name, options, previous): self.key = Expression(options['key'], transmogrifier, name, options) self.value = Expression(options['value'], transmogrifier, name, options) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.previous = previous
def __init__(self, transmogrifier, name, options, previous): self.subpipes = collections.deque() pipe_ids = sorted([ k for k in options if k.startswith('pipeline-') and not k.endswith('-condition') ]) if len(pipe_ids) < 2: raise ValueError('%s: Need at least two sub-pipes for a splitter' % name) splitter_head = list(itertools.tee(previous, len(pipe_ids))) for pipe_id, pipeline in zip(pipe_ids, splitter_head): condition = options.get('%s-condition' % pipe_id) if condition: condition = Condition(condition, transmogrifier, name, options, pipeline=pipe_id) condition = SplitterConditionSection(condition, pipeline) sections = options[pipe_id].splitlines() pipeline = constructPipeline(transmogrifier, sections, condition) self.subpipes.appendleft((condition, pipeline))
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.target = options['target'] self.logger = logging.getLogger(name) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.prefixes = [ ('left', 'title', options.get('left-title-prefix', '_left_portlet_title')), ('left', 'text', options.get('left-text-prefix', '_left_portlet_text')), ('right', 'title', options.get('right-title-prefix', '_right_portlet_title')), ('right', 'text', options.get('right-text-prefix', '_right_portlet_text')), ] if self.target: self.target = self.target.rstrip('/') + '/' if 'path-key' in options: pathkeys = options['path-key'].splitlines() else: pathkeys = defaultKeys(options['blueprint'], name, 'path') self.pathkey = Matcher(*pathkeys)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.target = options['target'] self.logger = logging.getLogger(name) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.skip_existing = options.get('skip-existing', 'False').lower() in ['true', 'yes'] self.skip_unmodified = options.get('skip-unmodified', 'True').lower() in ['true', 'yes'] self.skip_fields = set([ f.strip() for f in options.get('skip-fields', '').split('\n') if f.strip() ]) self.creation_key = options.get('creation-key', '_creation_flag').strip() self.headers_key = options.get('headers-key', '_content_info').strip() self.defaultpage_key = options.get('defaultpage-key', '_defaultpage').strip() if self.target: self.target = self.target.rstrip('/') + '/' if 'path-key' in options: pathkeys = options['path-key'].splitlines() else: pathkeys = defaultKeys(options['blueprint'], name, 'path') self.pathkey = Matcher(*pathkeys)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.key = Expression(options['key'], transmogrifier, name, options) self.pattern = Expression(options['pattern'], transmogrifier, name, options) self.repl = Expression(options['repl'], transmogrifier, name, options) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options)
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)
def __init__(self, transmogrifier, name, options, previous): self.context = transmogrifier.context self.portal_url = getToolByName(self.context, 'portal_url') self.previous = previous self.condition = None if 'condition' in options: self.condition = Condition(options['condition'], transmogrifier, name, options)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.fields = Expression(options.get('fields', 'python:False'), transmogrifier, name, options) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.defaultpage = options.get('defaultpage', 'index-html') self.logger = logging.getLogger(name)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.template_key = options.get('template_key', '_template') self.hide_img_folders = options.get('hide_img_folders', 'True') self.exclude_key = options.get('key', '_exclude-from-navigation') self.condition = Condition(options.get('condition', 'python:False'), transmogrifier, name, options) self.logger = logging.getLogger(name)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.logger = logging.getLogger(options['blueprint']) self.data_field = options.get('data-field') self.schema_field = options.get('schema-field') self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.toignore=options.get('ignore','next\nprevios\n').strip().split('\n') self.toignore_re=options.get('ignore_re','').strip().split('\n') self.treeserializer = TreeSerializer(transmogrifier, name, options, previous) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.logger = logging.getLogger(name) self.options = options
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.commands = options.get('commands', '').strip().split('\n') self.input_key = options.get('input-key', 'text').strip() self.output_key = options.get('output-key', 'text').strip() self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.logger = logging.getLogger(name) self.options = options
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.datakey = defaultMatcher(options, 'data-key', name, 'data') self.mimetype = Expression(options['mimetype'], transmogrifier, name, options) self.field = Expression(options['field'], transmogrifier, name, options) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.items = IAnnotations(transmogrifier)[LISTKEY][options['section']] self.keys = Expression(options.get('keys', 'nothing'), transmogrifier, name, options) self.copykeys = Expression(options.get('copy-keys', 'nothing'), transmogrifier, name, options)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.strip_prefixes = Expression( options.get('strip-prefixes', 'python: []'), transmogrifier, name, options) self.mapping = Expression(options['mapping'], transmogrifier, name, options) self.pathkey = defaultMatcher(options, 'path-key', name, 'path')
def __init__(self, transmogrifier, name, options, previous): keys = options.get('keys') or '' self.keys = Matcher(*keys.splitlines()) if keys: self.dest = Expression(options['destination'], transmogrifier, name, options) self.delete = Matcher(*options.get('delete', '').splitlines()) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.previous = previous
def __init__(self, transmogrifier, name, options, previous): """The FieldMapper Blueprint provides powerful functionality to map and modify values on the given item. """ self.mapper = Expression(options['field-mapping'], transmogrifier, name, options) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.previous = previous
def __init__(self, transmogrifier, name, options, previous): self.ptransforms = getToolByName(transmogrifier.context, 'portal_transforms') self.keys = Matcher(*options['keys'].splitlines()) self.transform = options.get('transform') if not self.transform: self.target = options['target'] self.from_ = options.get('from') self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.previous = previous
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.condition = Condition( options.get('condition', 'python:True'), transmogrifier, name, options ) self.pathkey = defaultMatcher(options, 'path-key', name, 'path')
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.transmogrifier = transmogrifier self.storage = IAnnotations(transmogrifier).get(ANNOTATION_KEY) self.csv_headers = Condition(options.get('csv_headers', 'python:True'), transmogrifier, name, options) self.dialect = safe_unicode(options.get('dialect', 'excel')) self.roe = bool(int(options.get('raise_on_error', '1'))) 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-'))
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.min_links = options.get('min_links', 2) self.max_uplinks = options.get('max_uplinks', 2) self.mode = options.get('mode', 'links') if self.mode == 'path': self.parent_path = Expression(options['parent_path'], transmogrifier, name, options) self.treeserializer = TreeSerializer(transmogrifier, name, options, previous) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.logger = logging.getLogger(name)
def __init__(self, transmogrifier, name, options, previous): # self.key = Expression(options['key'], transmogrifier, name, options) self.template = Expression(options['template'], transmogrifier, name, options) # self.value = Expression(options['value'], transmogrifier, name, # options) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.previous = previous self.available_operators = ['*', '', '='] self.anno = IAnnotations(transmogrifier) self.storage = self.anno.setdefault(VALIDATIONKEY, [])
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.pathkey = options.get('path-key', '_path').strip() self.typekey = options.get('type-key', '_type').strip() self.entrieskey = options.get('entries-key', '_entries').strip() # If you only want to export a part of the site, you can # specify a start-path; use 'folder' to only export # '/plonesite/folder'. self.start_path = options.get('start-path', '').strip().split() # this is used for communication with 'logger' section self.anno = IAnnotations(transmogrifier) self.storage = self.anno.setdefault(VALIDATIONKEY, []) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options)
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() # only this section can add 'excluded_field' for marshalling #self.excludekey = defaultMatcher(options, 'exclude-key', name, 'excluded_fields') self.excludekey = options.get('exclude-key', '_excluded_fields').strip() self.exclude_fieldtypes = filter(None, [ i.strip() for i in options.get('exclude-fieldtypes', '').splitlines() ]) self.doc = minidom.Document() self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.debug = options.get('debug', False) self.filename = options.get('filename', 'data.json') self.path = resolvePackageReferenceOrFile(options.get('path', '')) self.types = options.get('types', []) self.sections = options.get('sections', []) self.results = self._unjsonify(self.path, self.types, self.sections) if self.path is None or not os.path.isdir(self.path): raise Exception('Path (' + str(self.path) + ') does not exists.') self.logger = logging.getLogger(name)
def __init__(self, transmogrifier, name, options, previous): self.previous = previous self.context = transmogrifier.context self.logger = logging.getLogger(options['blueprint']) self.pathkey = options.get('path-key', '_path') self.portlet_properties = Expression( options.get('portlet-properties', 'python:{}'), transmogrifier, name, options) self.condition = Condition(options.get('condition', 'python:True'), transmogrifier, name, options) self.portlet_handler = PortletHandler( options.get('manager-name'), options.get('assignment-path'), options.get('portlet-id') )