Exemple #1
0
"""Atom Threading Extensions

The document you are looking for is RFC 4685.
"""

from atomtools.atom import AtomCommon, AtomLink, AtomText
from atomtools.xml import define_namespace, QName, XMLObject

# Namespaces
#
thr_ns = define_namespace("thr", "http://purl.org/syndication/thread/1.0")

class ThrInReplyTo(AtomCommon):
    """3.  The 'in-reply-to' Extension Element.

    """
    def __init__(self, ref=None, href=None, source=None, type=None, **kwargs):
        super(ThrInReplyTo, self).__init__(**kwargs)
        self.ref = ref
        self.href = href
        self.source = source
        self.type = type

    @classmethod
    def from_xml(cls, element, **kwargs):
        return super(ThrInReplyTo, cls).from_xml(element,
                ref=element.attrib.get("ref"),
                href=element.attrib.get("href"),
                source=element.attrib.get("source"),
                type=element.attrib.get("type"),
                **kwargs)
Exemple #2
0
from __future__ import absolute_import
import base64
from datetime import datetime, tzinfo
import re
from xml.etree.ElementTree import QName

from atomtools.exceptions import ValidationError
from atomtools.utils import (create_text_xml, flatten_xml_content,
                             from_text_xml, wrap_xml_tree)
from atomtools.tzinfo import TzInfoFixedOffset, TzInfoUTC
from atomtools.xhtml import xhtml_ns
from atomtools.xml import define_namespace, XMLObject, xml_ns

# Namespace
#
atom_ns = define_namespace("atom", "http://www.w3.org/2005/Atom")


class AtomCommon(XMLObject):
    """Basic construct for all Atom elements.
    
    The optional attribute *base* defines the base for relative URLs for
    this and any inner elements.

    The optional *lang* attribute indicates the natural language for this
    and any inner element.
    """
    def __init__(self, base=None, lang=None, **kwargs):
        super(AtomCommon, self).__init__(**kwargs)
        self.base = base
        self.lang = lang
Exemple #3
0
"""Elements of the Atom Publication Protocol.

The document you are looking for is RFC 5023.
"""

from __future__ import absolute_import
from xml.etree.ElementTree import QName

from atomtools.atom import (atom_ns, AtomCommon, AtomCategory, AtomText,
                            AtomSource, AtomEntry, AtomFeed)
from atomtools.xml import define_namespace, XMLObject

app_ns = define_namespace("app", "http://www.w3.org/2007/app")


class AppCategories(AtomCommon):
    """7.  Category Documents
    
    """
    inner_factory = {
        "category": AtomCategory.from_xml,
    }
    standard_tag = QName(app_ns, "categories")
    content_type = "application/atomcat+xml"

    def __init__(self, fixed=False, scheme=None, href=None, categories=(),
                 **kwargs):
        super(AppCategories, self).__init__(**kwargs)
        self.fixed = fixed
        self.scheme = scheme
        self.href = href
Exemple #4
0
This is work in progress and will be extended as necessary. And probably
changed completely.

You can find the documentation in doc/ames in the source distribution.
"""

from atomtools.atom import (AtomCategory, AtomCommon, AtomDate,
                            AtomEntry, AtomLink, AtomPerson, AtomText,
                            atom_ns)
from atomtools.atompub import AppFeed, AppService
from atomtools.utils import create_text_xml, from_text_xml
from atomtools.xml import define_namespace, QName, XMLObject, xml_ns

# Namespace
#
asoc_ns = define_namespace("asoc", "http://www.alipedis.com/2012/asoc")


# Messaging
#

class AsocPost(AtomCommon):
    """An entry without requirement to have a title.
    
    """
    inner_factory = {
        "author": AtomPerson.from_xml,
        "category": AtomCategory.from_xml,
        "content": AtomText.from_xml,
        "link": AtomLink.from_xml,
        "published": AtomDate.from_xml,