Package buildxml :: Package xmlgetter :: Module state :: Class PortalSourceState
[hide private]
[frames] | no frames]

Class PortalSourceState

source code


This class encapsulates a source's state.

Instance Methods [hide private]
 
__init__(self, source_name)
Initialize the state.
source code
PortalSourceState
load(self)
Read state from a file self._filename .
source code
bool
write(self)
Write state to file self._filename .
source code
 
__setitem__(self, key, item)
Make State a dict-like object...
source code
 
__getitem__(self, key)
Make State a dict-like object...
source code
string
__str__(self)
Return printable and readable representation.
source code

Inherited from log.BaseLogger: logger

Inherited from log.BaseLogger (private): _getLogger

Class Variables [hide private]

Inherited from log.BaseLogger (private): _loggers

Instance Variables [hide private]
string last_query = None
The source's name, required only to make BaseLogger pick up the correct name for the logger.
dict url_map = None
A dictionary mapping URLs to related information, like e.g.
string _filename = None
The filename to which to write the state.
string source_name = None
The source's name again.

Inherited from log.BaseLogger (private): _source_name

Method Details [hide private]

__init__(self, source_name)
(Constructor)

source code 

Initialize the state.

Parameters:
  • source_name (string) - The sources name for which this is the state.
Overrides: log.BaseLogger.__init__

load(self)

source code 

Read state from a file self._filename . The highest available pickling protocol is used, this most certainly a binary representation.

Returns: PortalSourceState
Returns False if reading failed, the unpickled state otherwise.

write(self)

source code 

Write state to file self._filename . The highest available pickling protocol is used, this most certainly a binary representation.

Returns: bool
True if all went fine, False otherwise.

__setitem__(self, key, item)
(Index assignment operator)

source code 

Make State a dict-like object...

Parameters:
  • key - The key for the dict entry.
  • item - The item that will be stored under key.

__getitem__(self, key)
(Indexing operator)

source code 

Make State a dict-like object...

Parameters:
  • key - Get the item that is stored under key.
Returns:
The stored item.

__str__(self)
(Informal representation operator)

source code 

Return printable and readable representation. Heaving set the logging level to DEBUG increases verbosity so that all urls of the url_map are included.

Returns: string
A readable and printable representation of the instance.

Instance Variable Details [hide private]

url_map

A dictionary mapping URLs to related information, like e.g. the position of the content in a file retrieved in a previous run.
Type:
dict
Value:
None

source_name

The source's name again. This is a public property that is only used for displaying purposes, so it can be changed if necessary.
Type:
string
Value:
None