Example #1
0
 def create_entry(self, text):
     uuid = generate_uuid_uri()
     entry = E.load('./entry.atom').xml_root
     entry.get_child('id', ns=entry.xml_ns).xml_text =  uuid
     dt = get_isodate()
     entry.get_child('published', ns=entry.xml_ns).xml_text = dt
     entry.get_child('updated', ns=entry.xml_ns).xml_text = dt
     entry.get_child('content', ns=entry.xml_ns).xml_text = unicode(text)
     return uuid, entry
Example #2
0
    def make_entry(self, msg, node):
        uuid = generate_uuid_uri()
        entry = E.load('./entry.atom').xml_root
        entry.get_child('id', ns=entry.xml_ns).xml_text =  uuid
        dt = get_isodate()
        entry.get_child('author', ns=entry.xml_ns).get_child('name', ns=entry.xml_ns).xml_text = unicode(self.profile.username)
        entry.get_child('published', ns=entry.xml_ns).xml_text = dt
        entry.get_child('updated', ns=entry.xml_ns).xml_text = dt
        entry.get_child('content', ns=entry.xml_ns).xml_text = unicode(msg)

        if node != self.pubsub_top_level_node:
            tag = extract_url_trail(node)
            E(u'category', namespace=entry.xml_ns, prefix=entry.xml_prefix,
              attributes={u'term': unicode(tag)}, parent=entry)
        
        return uuid, entry