Parsers.Config.readlink() - Fix typo
pynag.Parsers - New class: LivestatusQuery

This class is a convenience class meant to help
construct queries to mk-livestatus.
pynag.Parsers.Livesatus: add write(), raw_query()

This patch creates new general purpose methods
for talking to mk-livestatus.

write():
  Write a query directly to livestatus
raw_query():
  Easily construct a query and write directly to livestatus

Helps with issue #170
pynag.Parsers.Livestatus.query(): update docstring
pynag.Parsers.Livestatus.query() refactored

Rewrote almost all of query() using the new
LivestatusQuery helper class and raw_query() method.

This method is still a monster, but hopefully clearer
to read now and better documented.

Issue #130
Parsers.LivestatusQuery: Capitalize all constants.

Make all constants capitalized for pep8 compliance.
Use livestatus if find_command_file fails
Tests - Seperate class for macro resolving
Added more tests for macro resolving

This exposes a few bugs namely:

* Host macros inherited from a parent not resolved correctly

* Invalid host macros return None instead of ''

Unit tests are currently failing as of this commit.
fix testdata: macrohost2 had invalid parent
Utils: New method is_macro()
Model - Bug fixes in macro resolving

This patch changes mainly 2 things:

New constant _UNRESOLVED_MACRO = '' used instead of
hardcoded '' everywhere.

Fix cases where None would often be returned instead
of ''
Add more macroresolving tests after coverage

Ran unit tests with coverage to spot untested codepaths.

get_contact_macros() is still untested, and looks very buggy.
Utils.is_macro(): Fix doctest

is_macro() is supposed to raise exception
if a valid string is not provided. Remove part
of the doctest that expects invalid type to return
empty string.
Merge pull request #176 from pynag/fix-customvars

Patches for resolving macros and custom variables
Model: Macros should be case insensitive

This patch fixes two problems with macro resolving:

* When asking for a custom variable it should be
  Case insensensitive (i.e. $_SERVICE_MACRO1 == service.__macro1)

* When calling get_all_macros() all macronames are returned in
  uppercase.
Model: Use Utils.is_macro() to test for macro
Fix undefined variable name
Merge branch 'master' into livestatus-queries

Conflicts:
	pynag/Parsers/__init__.py
Merge branch 'livestatus-queries'