6.6. The Atom Syndication Format (RFC4287)

This module defines functions and classes for working with the Atom Syndication Format as defined by RFC4287: http://www.ietf.org/rfc/rfc4287.txt

6.6.1. Reference

6.6.1.1. Elements

class pyslet.rfc4287.Feed(parent)

Bases: pyslet.rfc4287.Source

Represents an Atom feed.

This is the document (i.e., top-level) element of an Atom Feed Document, acting as a container for metadata and data associated with the feed

AtomIdClass

alias of AtomId

TitleClass

alias of Title

UpdatedClass

alias of Updated

Entry = None

atomEntry

class pyslet.rfc4287.Source(parent)

Bases: pyslet.rfc4287.Entity

Metadata from the original source feed of an entry.

This class is also used a base class for Feed.

Generator = None

atomGenerator

Icon = None

atomIcon

atomLogo

Subtitle = None

atomSubtitle

class pyslet.rfc4287.Entry(parent)

Bases: pyslet.rfc4287.Entity

Represents an individual entry

Acts as a container for metadata and data associated with the entry.

AtomIdClass

alias of AtomId

TitleClass

alias of Title

UpdatedClass

alias of Updated

LinkClass

alias of Link

class pyslet.rfc4287.Entity(parent)

Bases: pyslet.rfc4287.AtomElement

Base class for feed, entry and source elements.

LinkClass

alias of Link

AtomId = None

the atomId of the object

Note that we qualify the class name used to represent the id to avoid confusion with the existing ‘id’ attribute in Element.

Author = None

atomAuthor

Category = None

atomCategory

Contributor = None

atomContributor

atomLink

Rights = None

atomRights

Title = None

atomTitle

Updated = None

atomUpdated

class pyslet.rfc4287.Author(parent)

Bases: pyslet.rfc4287.Person

A Person construct that indicates the author of the entry or feed.

class pyslet.rfc4287.Category(parent)

Bases: pyslet.rfc4287.AtomElement

Information about a category associated with an entry or feed.

term = None

a string that identifies the category to which the entry or feed belongs

scheme = None

an IRI that identifies a categorization scheme.

This is not converted to a pyslet.rfc2396.URI instance as it is not normally resolved to a resource. Instead it defines a type of namespace.

label = None

a human-readable label for display in end-user applications

class pyslet.rfc4287.Content(parent)

Bases: pyslet.rfc4287.Text

Contains or links to the content of the entry.

Although derived from Text this class overloads the meaning of the Text.type attribute allowing it to be a media type.

src = None

link to remote content

get_value()

Gets a single string representing the value of the element.

Overloads the basic get_value(), if type is a media type rather than one of the text types then a ValueError is raised.

class pyslet.rfc4287.Contributor(parent)

Bases: pyslet.rfc4287.Person

A Person construct representing a contributor

Indicates a person or other entity who contributed to the entry or feed.

class pyslet.rfc4287.Generator(parent)

Bases: pyslet.rfc4287.AtomElement

Identifies the agent used to generate a feed

The agent is used for debugging and other purposes.

uri = None

the uri of the tool used to generate the feed

version = None

the version of the tool used to generate the feed

set_pyslet_info()

Sets this generator to a default value

A representation of this Pyslet module.

class pyslet.rfc4287.Icon(parent)

Bases: pyslet.rfc4287.AtomElement

An image that provides iconic visual identification for a feed.

uri = None

a URI instance representing the URI of the icon

get_value()

Returning a pyslet.rfc2396.URI instance.

set_value(value)

Enables the value to be set from a URI instance.

If value is a string it is used to set the element’s content, content_changed() is then called to update the value of uri. If value is a URI instance then uri is set directory and it is then converted to a string and used to set the element’s content.

content_changed()

Sets uri accordingly.

class pyslet.rfc4287.AtomId(parent, name=None)

Bases: pyslet.rfc4287.AtomElement

A permanent, universally unique identifier for an entry or feed.

Bases: pyslet.rfc4287.AtomElement

A reference from an entry or feed to a Web resource.

href = None

a URI instance, the link’s IRI

rel = None

a string indicating the link relation type

type = None

an advisory media type

hreflang = None

the language of the resource pointed to by href

title = None

human-readable information about the link

length = None

an advisory length of the linked content in octets

Bases: pyslet.rfc4287.Icon

An image that provides visual identification for a feed.

class pyslet.rfc4287.Published(parent)

Bases: pyslet.rfc4287.Date

A Date construct indicating an instant in time associated with an event early in the life cycle of the entry.

class pyslet.rfc4287.Rights(parent)

Bases: pyslet.rfc4287.Text

A Text construct that conveys information about rights held in and over an entry or feed.

class pyslet.rfc4287.Subtitle(parent)

Bases: pyslet.rfc4287.Text

A Text construct that conveys a human-readable description or subtitle for a feed.

class pyslet.rfc4287.Summary(parent)

Bases: pyslet.rfc4287.Text

A Text construct that conveys a short summary, abstract, or excerpt of an entry.

class pyslet.rfc4287.Title(parent)

Bases: pyslet.rfc4287.Text

A Text construct that conveys a human-readable title for an entry or feed.

class pyslet.rfc4287.Updated(parent)

Bases: pyslet.rfc4287.Date

A Date construct indicating the most recent instant in time when an entry or feed was modified in a way the publisher considers significant.

6.6.1.2. Base Classes

class pyslet.rfc4287.Person(parent)

Bases: pyslet.rfc4287.AtomElement

An element that describes a person, corporation, or similar entity

NameClass

alias of Name

URIClass

alias of URI

class pyslet.rfc4287.Name(parent, name=None)

Bases: pyslet.rfc4287.AtomElement

A human-readable name for a person.

class pyslet.rfc4287.URI(parent, name=None)

Bases: pyslet.rfc4287.AtomElement

An IRI associated with a person

class pyslet.rfc4287.Email(parent, name=None)

Bases: pyslet.rfc4287.AtomElement

An e-mail address associated with a person

class pyslet.rfc4287.Text(parent)

Bases: pyslet.rfc4287.AtomElement

Base class for atomPlainTextConstruct and atomXHTMLTextConstruct.

set_value(value, type=1)

Sets the value of the element. type must be a value from the TextType enumeration

Overloads the basic SetValue() implementation, adding an additional type attribute to enable the value to be set to either a plain TextType.text, TextType.html or TextType.xhtml value. In the case of an xhtml type, value is parsed for the required XHTML div element and this becomes the only child of the element. Given that the div itself is not considered to be part of the content the value can be given without the enclosing div, in which case it is generated automatically.

get_value()

Gets a single unicode string representing the value of the element.

Overloads the basic get_value() implementation to add support for text of type xhtml.

When getting the value of TextType.xhtml text the child div element is not returned as it is not considered to be part of the content.

class pyslet.rfc4287.TextType

Bases: pyslet.xml.xsdatatypes.Enumeration

text type enumeration:

"text" | "html" | "xhtml"

This enumeration is used for setting the Text.type attribute.

Usage: TextType.text, TextType.html, TextType.xhtml

class pyslet.rfc4287.Date(parent)

Bases: pyslet.rfc4287.AtomElement

An element conforming to the definition of date-time in RFC3339.

This class is modeled using the iso8601 module.

date = None

a TimePoint instance representing this date

get_value()

Overrides get_value(), returning a pyslet.iso8601.TimePoint instance.

set_value(value)

Overrides SetValue(), enabling the value to be set from a pyslet.iso8601.TimePoint instance.

If value is a string the behaviour is unchanged, if value is a TimePoint instance then it is formatted using the extended format of ISO 8601 in accordance with the requirements of the Atom specification.

content_changed()

Re-reads the value of the element and sets date accordingly.

class pyslet.rfc4287.AtomElement(parent, name=None)

Bases: pyslet.xml.namespace.NSElement

Base class for all APP elements.

All atom elements can have xml:base and xml:lang attributes, these are handled by the Element base class.

See GetLang() and SetLang(), GetBase() and SetBase()

6.6.1.3. Constants

pyslet.rfc4287.ATOM_NAMESPACE = 'http://www.w3.org/2005/Atom'

The namespace to use for Atom Document elements

pyslet.rfc4287.ATOM_MIMETYPE = 'application/atom+xml'

The mime type for Atom Document