libbe.command.import_xml

class libbe.command.import_xml.Import_XML(*args, **kwargs)

Import comments and bugs from XML

>>> import time
>>> import StringIO
>>> import libbe.bugdir
>>> bd = libbe.bugdir.SimpleBugDir(memory=False)
>>> io = libbe.command.StringInputOutput()
>>> io.stdout = sys.stdout
>>> ui = libbe.command.UserInterface(io=io)
>>> ui.storage_callbacks.set_storage(bd.storage)
>>> cmd = Import_XML(ui=ui)
>>> ui.io.set_stdin('<be-xml><comment><uuid>c</uuid><body>This is a comment about a</body></comment></be-xml>')
>>> ret = ui.run(cmd, {'comment-root':'/a'}, ['-'])
>>> bd.flush_reload()
>>> bug = bd.bug_from_uuid('a')
>>> bug.load_comments(load_full=False)
>>> comment = bug.comment_root[0]
>>> print comment.body
This is a comment about a

>>> comment.time <= int(time.time())
True
>>> comment.in_reply_to is None
True
>>> ui.cleanup()
>>> bd.cleanup()

Methods

cleanup()
complete([argument, fragment])
help(*args)
run([options, args])
usage()
name = 'import-xml'
libbe.command.import_xml.Import_xml

alias of Import_XML

This Page