Package entropy :: Module misc :: Class FastRSS

Class FastRSS

source code


This is a fast class for handling RSS files through Python's xml.dom.minidom module. It produces 100% W3C-complaint code. Any functionality exposed works in O(1) time (apart from commit() which is O(n)).

Instance Methods
 
__init__(self, rss_file_path)
RSS constructor
source code
bool
is_new(self)
Return whether the file has been newly created or not
source code
 
set_title(self, title)
Set feed title
source code
 
set_language(self, language)
Set feed language
source code
 
set_description(self, description)
Set feed description
source code
 
set_max_entries(self, max_entries)
Set the maximum amount of rss feed entries, -1 for infinity
source code
 
set_editor(self, editor)
Set rss feed editor name
source code
 
set_url(self, url)
Set rss feed url name
source code
 
set_year(self, year)
Set rss feed copyright year
source code
 
append(self, title, link, description, pub_date)
Add new entry
source code
xml.dom.Document object
get(self)
Return xml.minidom Document object.
source code
 
commit(self)
Commit changes to file
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  BASE_TITLE = 'No title'
  BASE_DESCRIPTION = 'No description'
  BASE_EDITOR = 'No editor'
  BASE_URL = 'http://www.sabayon.org'
  MAX_ENTRIES = -1
  LANGUAGE = 'en-EN'
Properties

Inherited from object: __class__

Method Details

__init__(self, rss_file_path)
(Constructor)

source code 

RSS constructor

Parameters:
  • rss_file_path (string) - RSS file path (a new file will be created if not found)
Overrides: object.__init__

is_new(self)

source code 

Return whether the file has been newly created or not

Returns: bool
True, if rss is new

set_title(self, title)

source code 

Set feed title

Parameters:
  • title (string) - rss feed title
Returns:
this instance, for chaining

set_language(self, language)

source code 

Set feed language

Parameters:
  • title (string) - rss language
Returns:
this instance, for chaining

set_description(self, description)

source code 

Set feed description

Parameters:
  • description (string) - rss feed description
Returns:
this instance, for chaining

set_max_entries(self, max_entries)

source code 

Set the maximum amount of rss feed entries, -1 for infinity

Parameters:
  • description (int) - rss feed max entries value
Returns:
this instance, for chaining

set_editor(self, editor)

source code 

Set rss feed editor name

Parameters:
  • editor (string) - rss feed editor name
Returns:
this instance, for chaining

set_url(self, url)

source code 

Set rss feed url name

Parameters:
  • url (string) - rss feed url
Returns:
this instance, for chaining

set_year(self, year)

source code 

Set rss feed copyright year

Parameters:
  • url (string) - rss feed copyright year
Returns:
this instance, for chaining

append(self, title, link, description, pub_date)

source code 

Add new entry

Parameters:
  • title (string) - entry title
  • link (string) - entry link
  • description (string) - entry description
  • pubDate (string) - entry publication date

get(self)

source code 

Return xml.minidom Document object.

Returns: xml.dom.Document object
the Document object