def load(argv=sys.argv, peopleconf=peopleconf, root=None): # last args for unit testing parser = create_karl_argparser( description='Load people directory configuration.' ) parser.add_argument('-f', '--force-reindex', action='store_true', help='Reindex the people directory unconditionally.') parser.add_argument('filename', help='Name of XML to load.') args = parser.parse_args(argv[1:]) if root is None: # only untrue during unit testing env = args.bootstrap(args.config_uri) root = env['root'] force_reindex = args.force_reindex tree = etree.parse(args.filename) if 'people' in root and not isinstance(root['people'], PeopleDirectory): # remove the old people directory del root['people'] if 'people' not in root: root['people'] = PeopleDirectory() force_reindex = True peopleconf(root['people'], tree, force_reindex=force_reindex) transaction.commit()
def load(argv=sys.argv, peopleconf=peopleconf, root=None): # last args for unit testing parser = create_karl_argparser( description='Load people directory configuration.') parser.add_argument('-f', '--force-reindex', action='store_true', help='Reindex the people directory unconditionally.') parser.add_argument('filename', help='Name of XML to load.') args = parser.parse_args(argv[1:]) if root is None: # only untrue during unit testing env = args.bootstrap(args.config_uri) root = env['root'] force_reindex = args.force_reindex tree = etree.parse(args.filename) if 'people' in root and not isinstance(root['people'], PeopleDirectory): # remove the old people directory del root['people'] if 'people' not in root: root['people'] = PeopleDirectory() force_reindex = True peopleconf(root['people'], tree, force_reindex=force_reindex) transaction.commit()
def upload_peopledirectory_xml(context, request): peopledir = find_peopledirectory(context) if 'form.submit' in request.POST: # 'xml' should be the uploaded file. xml = request.POST['xml'].file tree = etree.parse(xml) peopleconf(context, tree, force_reindex=True) return HTTPFound(location=resource_url(context, request)) return dict(api=TemplateAPI(context, request, 'Upload People XML'), peopledir=peopledir, #actions=get_actions(context, request), )
def upload_peopledirectory_xml(context, request): peopledir = find_peopledirectory(context) if 'form.submit' in request.POST: # 'xml' should be the uploaded file. xml = request.POST['xml'].file tree = etree.parse(xml) peopleconf(context, tree, force_reindex=True) return HTTPFound(location=resource_url(context, request)) return dict( api=TemplateAPI(context, request, 'Upload People XML'), peopledir=peopledir, #actions=get_actions(context, request), )
def load(args): force_reindex = args.force_reindex root, closer = args.get_root(args.inst) tree = etree.parse(args.filename) if 'people' in root and not isinstance(root['people'], PeopleDirectory): # remove the old people directory del root['people'] if 'people' not in root: root['people'] = PeopleDirectory() force_reindex = True peopleconf(root['people'], tree, force_reindex=force_reindex) transaction.commit()
def _callFUT(self, peopledir, elem, **kw): from karl.utilities.peopleconf import peopleconf return peopleconf(peopledir, elem, **kw)
def _callFUT(self, peopledir, elem, **kw): from karl.utilities.peopleconf import peopleconf return peopleconf(peopledir, elem, **kw)