Package entropy :: Package client :: Package interfaces :: Module noticeboard :: Class NoticeBoard

Class NoticeBoard

source code


Main interface for handling Repository Notice Board user data, such as notice board items status, metadata retrieval, etc.

Instance Methods
 
__init__(self, repository_id)
Object constructor.
source code
dict
data(self)
Return the noticeboard RSS metadata.
source code
 
mark_read(self, item_id, read_status)
Set the given noticeboard item read status.
source code
set
items_read(self)
Return noticeboard items read status.
source code
 
mark_all_read(self, status)
Mark all the noticeboard items as read or unread.
source code
 
is_all_read(self)
Return whether the noticeboard has been marked as read.
source code

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

Class Methods
bool
are_read(cls, repository_ids)
Return whether all the noticeboards of the repositories are marked as read.
source code
Properties

Inherited from object: __class__

Method Details

__init__(self, repository_id)
(Constructor)

source code 

Object constructor.

Parameters:
  • repository_id (string) - the repository identifier
Overrides: object.__init__

data(self)

source code 

Return the noticeboard RSS metadata.

This method is fault tolerant, except for invalid repository_id given, if repository notice board file is broken or not found an empty dict is returned.

Returns: dict
repository metadata
Raises:
  • KeyError - if given repository identifier is not available

mark_read(self, item_id, read_status)

source code 

Set the given noticeboard item read status.

This method also handles repository user metadata on-disk storage, this is a "one-shot" function, no need to call anything else.

Parameters:
  • item_id (int) - repository noticeboard item identifier
  • read_status (bool) - read status (True if read, False if not)
Raises:
  • KeyError - if given repository identifier is not valid

items_read(self)

source code 

Return noticeboard items read status.

Returns: set
item identifiers marked as "read"

mark_all_read(self, status)

source code 

Mark all the noticeboard items as read or unread.

The read status will be automatically tainted when noticeboard items are updated.

Parameters:
  • status (bool) - True, if items must be marked as read, False otherwise

are_read(cls, repository_ids)
Class Method

source code 

Return whether all the noticeboards of the repositories are marked as read.

Parameters:
  • repository_ids (list) - list of repository identifiers
Returns: bool
True if they are all marked as read, False otherwise