global: test suite nosification

* Makes unit and regression test cases more friendly with respect to
  nose defaults.  That is, decorates functions that are not test cases
  as such, otherwise nose's defaults would consider them when running
  the test suite.  The nosification is useful for plugging test case
  output to Jenkins.

* Fixes all the codebase except WebSubmitFileConverterTestGenerator
  dynamically generated test cases in websubmit_regression_tests.py.

* Note that it is now possible to run unit tests like:
  `nosetests /opt/invenio/lib/python/invenio/*_unit_tests.py`
  and regression tests like:
  `nosetests /opt/invenio/lib/python/invenio/*_regression.py`.
  This gives equivalent results to `inveniocfg --run-unit-tests` and
  `inveniocfg --run-regression-tests`, respectively, modulo dynamically
  generated WebSumit tests mentioned above.

* Also, activates WebComment test cases that were accidentally
  commented out in 231caa6b80a41ad9a6b37f5bf7ddb142190742ed.
Merge branch 'maint-1.1'

* maint-1.1:
  global: test suite nosification

* Merge note: adds all tests from `refextract_unit_tests.py`,
  amends other files like `solrutils_unit_tests.py`,
  `weblinkback_regression_tests.py`, and
  `websearch_regression_tests.py`.

Conflicts:
	modules/miscutil/lib/testutils.py
	modules/refextract/lib/refextract_authextract_unit_tests.py
solrutils: clean unit and regression test suite

* Moves Atlantis test cases to regression test suite.
  (closes #1284)

Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
htmlutils: fix single quote escaping

* Fixes function escape_html() to translate single quotes into
  correct HTML entity; `&#39;` -> `'` instead of `&#34;` -> `"`.
Merge branch 'maint-1.1'

* maint-1.1:
  htmlutils: fix single quote escaping
htmlutils: improve js string escaping

* Moves/renames jsonutils.wash_for_js() function to
  htmlutils.escape_javascript_string() as this function would mostly
  be used to escape javascript in HTML context.
  Updates bfe_bookmark accordingly.

* No longer adds double-quotes around the returned string in
  order to be more flexible regarding the context in which the
  string is inserted.

* More complete escaping of Javascript chars when 'json' is not
  installed.

* Adds parameters to control the level of escaping, to be adjusted
  according to the context (HTML vs JS output, XHTML vs HTML,
  content-type, use of CDATA delimiters).

* Adds docstrings and unit tests.

* Merge note: fixed indentation in `htmlutils.py`.

Tested-by: Tibor Simko <tibor.simko@cern.ch>
mathpreview: js-based math preview panel

* JQuery plugin to display math rendering (via MathJax) preview
  next to input fields or textareas.

* Plugged for submissions, and enabled via CFG_WEBSUBMIT_USE_MATHJAX.
  (closes #1221)

* Enriches Submission Guide in consequence.

* Updates MathJax configuration to enable '$' escaping, with
  tex2jax->processEscapes=true, as recommended in MathJax doc
  when using '$' as inline delimiters

Tested-by: Tibor Simko <tibor.simko@cern.ch>
htmlutils: improve js string escaping

* Moves/renames jsonutils.wash_for_js() function to
  htmlutils.escape_javascript_string() as this function would mostly
  be used to escape javascript in HTML context.
  Updates bfe_bookmark accordingly.

* No longer adds double-quotes around the returned string in
  order to be more flexible regarding the context in which the
  string is inserted.

* More complete escaping of Javascript chars when 'json' is not
  installed.

* Adds parameters to control the level of escaping, to be adjusted
  according to the context (HTML vs JS output, XHTML vs HTML,
  content-type, use of CDATA delimiters).

* Adds docstrings and unit tests.

* Merge note: fixed indentation in `htmlutils.py`.

* Merge note: cherry-picked from
  86f6acbca4fe48a4af19940a6e6ab4344f5d0682.

Tested-by: Tibor Simko <tibor.simko@cern.ch>
Merge branch 'maint-1.1'

* maint-1.1:
  htmlutils: improve js string escaping
WebSession: login_method changes

* Is more gentle when login_methods are altered on an existing
  installation (e.g. by falling back to the default login method
  if the settings of a user specify a no longer existing login_method).

Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
WebSearch: permitted restricted colls for guests

* Guests users might be authorized to view restricted collections
  by virtue of a FireRole specifying an IP address. For this
  reason the permitted_restricted_collections variable in
  intersect_results_with_collrecs() is now computed explicitly
  without using the precached_permitted_restricted_collections
  key of user_info which is only computed at login time.

Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
BibCirculation: CERN LDAP improvements

* Improves handling of broken LDAP connections by retrying once
  more to connect and then giving up.

* Correctly escapes user input before using it in LDAP filters.

* Improves heuristic to discover CERN account corner cases, namely
  when a user left CERN and she still have a disabled account
  (identified by the "Primary" employeeType) and a new "ExCern"
  account.

* Removes no longer needed sleeping points.

* Reduces the number of calls to task_sleep_now_if_required() and
  task_update_progress().

* Improves progress report wording. (closes #1186)

Tested-by: Tibor Simko <tibor.simko@cern.ch>
WebSearch: webcoll performance improvements

* Introduces new -q/--quick CLI argument that improves webcoll
  performance by skipping the rebuilding of webpage cache
  for collections whose reclist has not been modified within the
  last phase1 run (unless --force or --collection CLI arguments
  were specified).

* Removes a point of sleep that could have lead to potential
  race conditions.

Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
WebAccess: new CERN auth method support

* Adds support for the CERN specific external_authentication_sso.py
  authentication plugin to expose more attributes provided by
  Shibboleth upon authentication, including the authentication method
  used by the user and the user identity class.

Reviewed-by: Tibor Simko <tibor.simko@cern.ch>
Merge branch 'maint-1.0' into maint-1.1

* maint-1.0:
  WebSession: login_method changes
Merge branch 'maint-1.1'

* maint-1.1:
  WebSession: login_method changes
global: test suite nosification

* Nosifies test suite for the maint-1.0 branch too.  The tests can be run via
  `sudo -u www-data nosetests /opt/invenio/lib/python/invenio/*_tests.py`.
Merge branch 'maint-1.0' into maint-1.1

* maint-1.0:
  global: test suite nosification
Merge branch 'maint-1.1'

* maint-1.1:
  global: test suite nosification
DocExtract: nose-friendly refextract tests