python-feedgen 0.2.8 documentation

feedgen.util

«  feedgen.entry   ::   Contents   ::   feedgen.ext.base  »

Contents

feedgen.util

This file contains helper functions for the feed generator module.

copyright:2013, Lars Kiesow <lkiesow@uos.de>
license:FreeBSD and LGPL, see license.* for more details.
feedgen.util.ensure_format(val, allowed, required, allowed_values=None, defaults=None)

Takes a dictionary or a list of dictionaries and check if all keys are in the set of allowed keys, if all required keys are present and if the values of a specific key are ok.

Parameters:
  • val – Dictionaries to check.
  • allowed – Set of allowed keys.
  • required – Set of required keys.
  • allowed_values – Dictionary with keys and sets of their allowed values.
  • defaults – Dictionary with default values.
Returns:

List of checked dictionaries.

«  feedgen.entry   ::   Contents   ::   feedgen.ext.base  »