loops/config
2016-04-22 11:17:45 +02:00
..
__init__.py work in progress: loops.config for generic management of configuration options, settings, preferences 2008-04-11 15:10:09 +00:00
base.py fix datatable source list; add generic IOptions adapter 2016-04-22 11:17:45 +02:00
browser.py work in progress: configuration (options/settings) user interface 2010-05-24 09:54:22 +00:00
configure.zcml fix datatable source list; add generic IOptions adapter 2016-04-22 11:17:45 +02:00
README.txt work in progress: configuration (options/settings) user interface 2010-05-24 09:54:22 +00:00
tests.py work in progress: loops.config for generic management of configuration options, settings, preferences 2008-04-11 15:10:09 +00:00
view_macros.pt work in progress: configuration (options/settings) user interface 2010-05-24 09:54:22 +00:00

===============================================================
loops - Linked Objects for Organization and Processing Services
===============================================================

Management of configuration settings and preferences.

  ($Id$)


Setting up a loops Site and Utilities
=====================================

Let's do some basic set up

  >>> from zope import component, interface
  >>> from zope.traversing.api import getName
  >>> from zope.app.testing.setup import placefulSetUp, placefulTearDown
  >>> site = placefulSetUp(True)

and build a simple loops site with a concept manager and some concepts
(with a relation registry, a catalog, and all the type machinery - what
in real life is done via standard ZCML setup or via local utility
configuration):

  >>> from loops.integrator.testsetup import TestSite
  >>> t = TestSite(site)
  >>> concepts, resources, views = t.setup()
  >>> loopsRoot = concepts.getLoopsRoot()


Options Adapters
================

Global and site options
-----------------------

  >>> from cybertools.meta.interfaces import IOptions
  >>> opt = IOptions(loopsRoot)
  >>> opt
  <loops.config.base.LoopsOptions object ...>
  >>> str(opt)
  ''

We now use the loops root object's options field to define
some options.

  >>> loopsRoot.options = ['useVersioning', 'organize.tracking:changes, access']
  >>> opt = IOptions(loopsRoot)

  >>> opt.organize.tracking
  ['changes', 'access']
  >>> opt.useVersioning
  True

  >>> print opt
  organize(tracking=['changes', 'access'])
  useVersioning=True

If we query an option that is not defined on the site level we get a
dummy element that corresponds to False.

  >>> opt.i18n.languages
  <AutoElement 'languages'>
  >>> bool(opt.i18n.languages)
  False

We can use a utility for providing global settings.

  >>> from cybertools.meta.interfaces import IOptions
  >>> globalOpt = component.getUtility(IOptions)
  >>> globalOpt.i18n.languages = ['en', 'de']
  >>> globalOpt.i18n.languages
  ['en', 'de']

If we call the site options with the key we want to query the global
options will be used as a fallback.

  >>> opt('i18n.languages')
  ['en', 'de']

User options (preferences)
--------------------------

Type- and object-based settings
-------------------------------


Configurator User Interface
===========================


Fin de partie
=============

  >>> placefulTearDown()