Package amplee :: Package loader :: Module iniloader
[hide private]
[frames] | no frames]

Module iniloader

source code

Atom Publising Store loader

Synopsis
--------

The process of creating an Atom Publishing store is
a repetitive task that is common to all projects.

The loader module offers the possibility to automate
this task by putting required information in a
configuration file and let the `loader`function
generates the store from the configuration settings.

Consider the following:

>>> from amplee.loader import loader
>>> service, config = loader('/my/config.cfg')

The ``service`` object returned is an instance of
``amplee.atompub.service.AtomPubService`` and is your
reference to all the related objects.

The ``config`` object is an instance of
``amplee.loader.Config`` and is the representation
of your configuration file.

Classes [hide private]
  Config
Represents an INI file as a tree of Config instances
Functions [hide private]
object
init_storage(config, storage, base_path=None)
Initializes a storage as described in the configuration object.
source code
 
init_workspaces(config, service, base_path=None)
Initializes the Atom Publishing Protocol workspaces from the provided service.
source code
 
get_xml_attribs(config, section_name)
Returns a dictionary of xml attributes with their associated value.
source code
 
init_collections(config, workspace_name, workspace, base_path=None)
Initializes the Atom Publishing Protocol collections from the provided workspace.
source code
 
set_collection_attributes(config, workspace_name, workspace, collection_name, collection, base_path=None) source code
 
handle_categories(config, collection_name) source code
 
_load_callable(value, base_path=None) source code
 
_load_symbol(value, base_path=None) source code
tuple
loader(conf_path, encoding='ISO-8859-1', base_path=None)
Creates the structure of an APP store following settings provided by the configuration file.
source code
Variables [hide private]
  __doc__ = """Atom Publising Store loa...
  _module_callable_regex = re.compile(r'module:(.*),callable:(.*)')
  _module_symbol_regex = re.compile(r'module:(.*),symbol:(.*)')
  __warningregistry__ = {('The INI loader will be deprecated in ...
Function Details [hide private]

init_storage(config, storage, base_path=None)

source code 

Initializes a storage as described in the configuration object.

[svn_storage] repository_uri = file:///var/repo working_copy_path = /home/my/copy username = test password =

>>> from amplee.loader import loader, Config
>>> conf = Config()
>>> conf.from_ini('./my.conf')
>>> storage = loader.init_storage(conf, 'svn_storage')
Parameters:
  • config (Conf) - instance of a configuration object
  • storage (string) - section name of the storage to load.
  • base_path (string) - only required when your configuration settings use relative path in their values.
Returns: object
instance of the loaded storage

init_workspaces(config, service, base_path=None)

source code 

Initializes the Atom Publishing Protocol workspaces from the provided service.

Parameters:
  • config (Conf) - instance of a configuration object
  • service (AtomPubService) - service instance
  • base_path (string) - if provided, every relative path will be resolved to that base path.

init_collections(config, workspace_name, workspace, base_path=None)

source code 

Initializes the Atom Publishing Protocol collections from the provided workspace.

Parameters:
  • config (Conf) - instance of a configuration object
  • workspace_name (string) - name of the section associated with the parent workspace
  • workspace (AtomPubWorkspace) - loaded workspace
  • base_path (string) - if provided, every relative path will be resolved to that base path.

loader(conf_path, encoding='ISO-8859-1', base_path=None)

source code 

Creates the structure of an APP store following settings provided by the configuration file. It returns the created service instance as well as the configuration instance.

>>> import os
>>> from amplee.loader import loader
>>> service, conf = loader('./my.conf', base_path=os.getcwd())
Parameters:
  • conf_path (string) - path to the configuration settings
  • encoding (string) - indicates how to encode each value of the settings
  • base_path (string) - if provided, will be prepended to all the values which require a path
Returns: tuple
a tuple where the first item is an instance of the AtomPubService class and the second item is the Config instance.

Variables Details [hide private]

__doc__

Value:
"""Atom Publising Store loader

Synopsis
--------

The process of creating an Atom Publishing store is
a repetitive task that is common to all projects.

...

__warningregistry__

Value:
{('The INI loader will be deprecated in a future release of amplee.',
  <type 'exceptions.DeprecationWarning'>,
  38): 1}