|
@@ -1,60 +0,0 @@
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-try:
|
|
|
- from xml.etree.cElementTree import Element, SubElement, dump, ElementTree
|
|
|
-except ImportError:
|
|
|
- from cElementTree import Element, SubElement, dump, ElementTree
|
|
|
-
|
|
|
-from pwman.data.nodes import Node
|
|
|
-from pwman.data.tags import Tag
|
|
|
-
|
|
|
-class Exporter:
|
|
|
- def types(self):
|
|
|
- return ["pwman3"]
|
|
|
- types = classmethod(types)
|
|
|
-
|
|
|
- def get(self, type):
|
|
|
- if type == "pwman3":
|
|
|
- return Pwman3Exporter()
|
|
|
- get = classmethod(get)
|
|
|
-
|
|
|
- def export_data(self, db, file, nodeids):
|
|
|
- pass
|
|
|
-
|
|
|
-class Pwman3Exporter(Exporter):
|
|
|
- def export_data(self, db, file, nodeids):
|
|
|
- nodeids = db.listnodes()
|
|
|
-
|
|
|
- nodes = db.getnodes(nodeids)
|
|
|
- root = Element("PwmanXmlList", version="3.0")
|
|
|
- for n in nodes:
|
|
|
- sub = SubElement(root, "Node")
|
|
|
- SubElement(sub, "username").text = n.get_username()
|
|
|
- SubElement(sub, "password").text = n.get_password()
|
|
|
- SubElement(sub, "url").text = n.get_url()
|
|
|
- SubElement(sub, "notes").text = n.get_notes()
|
|
|
- tagelement = SubElement(sub, "tags")
|
|
|
- for t in n.get_tags():
|
|
|
- SubElement(tagelement, "name").text = t.get_name()
|
|
|
-
|
|
|
- ElementTree(root).write(file)
|