task/us93-ta65 -- RETURNS and RETURNS_REFERENCE ORM update - functional

nparcel/table/returns_reference.py
* new RETURNS_REFERENCE ORM

nparcel/table/returns.py
* new RETURNS ORM
task/us93-ta70 -- SQL to extract details from the RETURNS table based
on id - functional

nparcel/dbsession.py
* new attribute db_type that captures the database type (for example,
  ``sqlite`` or ``MSSQL``)

nparcel/table/__init__.py
* update the __init__() signature to accept an alias parameter

nparcel/table/returns_reference.py
* new method reference_nbr_sql() to provide an SQL wrapper to extract
  the returns_reference.reference_nbr of items relating to returns_id

nparcel/table/returns.py
* new method extract_id_sql() SQL wrapper to extract the returns
  against id

nparcel/dbsession.py
* port sqlite library to sqlite3
task/us93-ta67 -- Returns comms templates

nparcel/templates/email_err_ret_html.t
nparcel/templates/email_ret_html.t
nparcel/templates/sms_ret_xml.t
nparcel/templates/subject_ret_html.t
* new returns templates
task/us93-ta68 -- Returns comms trigger

nparcel/comms.py
nparcel/commsdaemon.py
* factor out the comms_dir attribute into nparcel/commsdaemon.py
feature/us-93 -- refactor work across nparcel/comms.py

nparcel/comms.py
* class Comms() now inherits from nparcel.Service() to utilise
  the generic DB connectivity
* __init__() method paramater list converted to varargs
* factor out the template_base attribute as this is now taken from
  nparcel.EmailerBase()

nparcel/commsdaemon.py
* update the _start() method to build a kwargs structure to
  initialise nparcel.Comms()
* refactor the nparcel.Comms() kwargs initialiser with new
  properties sms_api(), email_api() and comms_kwargs()

nparcel/emailer.py
* factor our the template_base attribute as this is now taken from
  nparcel.EmailerBase()

nparcel/emailerbase.py
* make the template_base attribute a part of nparcel.EmailerBase()

nparcel/restemailer.py
* break the multiple inheritance arrangement.  nparcel.Rest is now
  a component class
nparcel/restsmser.py
* nparcel.RestSmser() now has its own instance of the template_base
  attribute so that it can build SMS messages from a templated source
* refactor the create_comms() method so that if the base_dir parameter
  is not None it can override the template_base attribute's value
feature/us-93 -- refactor comms facility config items

nparcel/commsb2cconfig.py
* factor our the comms facility config items into a separate module

nparcel/conf/nparceld.conf
* new config items controlled_templates and uncontrolled_templates
task/us93-ta68 -- Returns comms trigger (update 2)

nparcel/commsdaemon.py
* new attribute controlled_templates list of comms templates that are
  controlled by the delivery period thresholds
* refactor the get_comms_files() method to use the
  nparcel.utils.files.get_directory_files_list() function
* refactor the _start() method so that it can selectively invoke
  get_comms_files() based on templates provided by
  controlled_templates attribute
* integrate reporting so that each iteration presents a stats
  log item
task/us93-ta68 -- Returns comms trigger (update 3)

nparcel/commsdaemon.py
* new attribute controlled_templates that lists
* update the _start() method to build a list of comms events files on
  a combination if controlled_templates and uncontrolled_templates
* update the comms_kwargs property to include a list of
  template_tokens and returns_templates

nparcel/comms.py
* new attribute template_tokens list of template tokens that are
  currently supported
* refactor the parse_comms_filename() method so that all template
  tokens are configurable and we removed the hardwired dependency
  within the code
* new attribute returns_template_tokens that is a list of template
  tokens that extracts template detail from the RETURNS table
* refactor the get_agent_details() method so that the new template_token
  parameter value can control which table is used to build template
  detail
task/us93-ta71 -- Returns comms date/time localisation

nparcel/exporter.py
nparcel/postcode.py
* factor out the convert_timezone() logic into separate module that
  can be leveraged by other modules
* refactor the process() method to localise the returns.created_ts for
  "ret" template types (returns)

nparcel/table/returns.py
* add the state column to the SELECT clause of the extract_id_sql()
  method
task/us93-ta66 -- documentation update