Ejemplo n.º 1
0
 def from_xml(cls, element, **kwargs):
     for sub in element:
         if sub.tag == QName(atom_ns, "generator"):
             kwargs["generator"] = cls.inner_from_xml("generator", sub)
         elif sub.tag == QName(atom_ns, "icon"):
             kwargs["icon"] = from_text_xml(sub)
         elif sub.tag == QName(atom_ns, "logo"):
             kwargs["logo"] = from_text_xml(sub)
         elif sub.tag == QName(atom_ns, "subtitle"):
             kwargs["subtitle"] = cls.inner_from_xml("subtitle", sub)
     return super(AtomSource, cls).from_xml(element, **kwargs)
Ejemplo n.º 2
0
 def from_xml(cls, element, **kwargs):
     kwargs.setdefault("authors", [])
     kwargs.setdefault("categories", [])
     kwargs.setdefault("contributors", [])
     kwargs.setdefault("links", [])
     for sub in element:
         if sub.tag == QName(atom_ns, "author"):
             kwargs["authors"].append(cls.inner_from_xml("author", sub))
         elif sub.tag == QName(atom_ns, "category"):
             kwargs["categories"].append(cls.inner_from_xml("category",
                                                            sub))
         elif sub.tag == QName(atom_ns, "contributor"):
             kwargs["contributors"].append(
                     cls.inner_from_xml("contributor", sub))
         elif sub.tag == QName(atom_ns, "id"):
             kwargs["id"] = from_text_xml(sub)
         elif sub.tag == QName(atom_ns, "link"):
             kwargs["links"].append(cls.inner_from_xml("link", sub))
         elif sub.tag == QName(atom_ns, "rights"):
             kwargs["rights"] = cls.inner_from_xml("rights", sub)
         elif sub.tag == QName(atom_ns, "title"):
             kwargs["title"] = cls.inner_from_xml("title", sub)
         elif sub.tag == QName(atom_ns, "updated"):
             kwargs["updated"] = cls.inner_from_xml("updated", sub)
     return super(AtomMeta, cls).from_xml(element, **kwargs)
Ejemplo n.º 3
0
 def from_xml(cls, element, **kwargs):
     kwargs.setdefault("categories", [])
     kwargs.setdefault("links", [])
     for sub in element:
         if sub.tag == QName(atom_ns, "id"):
             kwargs["id"] = from_text_xml(sub)
         elif sub.tag == QName(asoc_ns, "uri"):
             kwargs["uri"] = from_text_xml(sub)
         elif sub.tag == QName(asoc_ns, "name"):
             kwargs["name"] = from_text_xml(sub)
         elif sub.tag == QName(atom_ns, "category"):
             kwargs["categories"].append(cls.inner_from_xml("category",
                                                            sub))
         elif sub.tag == QName(atom_ns, "link"):
             kwargs["links"].append(cls.inner_from_xml("link", sub))
     return super(AsocPeer, cls).from_xml(element, **kwargs)
Ejemplo n.º 4
0
 def from_xml(cls, element, **kwargs):
     kwargs.setdefault("authors", [])
     kwargs.setdefault("categories", [])
     kwargs.setdefault("links", [])
     for sub in element:
         if sub.tag == QName(atom_ns, "author"):
             kwargs["authors"].append(cls.inner_from_xml("author", sub))
         elif sub.tag == QName(atom_ns, "category"):
             kwargs["categories"].append(cls.inner_from_xml("category",
                                                            sub))
         elif sub.tag == QName(asoc_ns, "content"):
             kwargs["content"] = cls.inner_from_xml("content", sub)
         elif sub.tag == QName(atom_ns, "id"):
             kwargs["id"] = from_text_xml(sub)
         elif sub.tag == QName(atom_ns, "link"):
             kwargs["links"].append(cls.inner_from_xml("link", sub))
         elif sub.tag == QName(atom_ns, "publised"):
             kwargs["published"] = cls.inner_from_xml("published", sub)
         elif sub.tag == QName(atom_ns, "rights"):
             kwargs["rights"] = cls.inner_from_xml("rights", sub)
         elif sub.tag == QName(atom_ns, "updated"):
             kwargs["updated"] = cls.inner_from_xml("updated", sub)
     return super(AsocPost, cls).from_xml(element, **kwargs)