Exemplo n.º 1
0
 def __init__(self, **kwds):
     Plugin.__init__(self, **kwds)
     #super(ManagedSingletonPlugin,self).__init__(**kwds)
     declare_option(name=self.name,
                    section="Services",
                    local_name="enable",
                    default=self._enable,
                    cls=BoolOption,
                    doc="Option that controls behavior of service %s." %
                    self.name)
Exemplo n.º 2
0
 def __init__(self, **kwds):
     if getattr(self, '_initialized', False) is True:
         return
     self._initialized = True
     #
     kwds['name'] = 'TempfileManager'
     ManagedSingletonPlugin.__init__(self, **kwds)
     self._tempfiles = [[]]
     declare_option("tempdir", default=None)
     self._ctr = -1
Exemplo n.º 3
0
 def __init__(self, **kwds):
     Plugin.__init__(self, **kwds)
     #super(ManagedSingletonPlugin,self).__init__(**kwds)
     declare_option(
         name=self.name,
         section="Services",
         local_name="enable",
         default=self._enable,
         cls=BoolOption,
         doc="Option that controls behavior of service %s." % self.name)
Exemplo n.º 4
0
 class TMP_dict2(Plugin):
     declare_option("options", DictOption)
     declare_option("b", local_name="o1")
     declare_option("c", local_name="o2", default=3)
Exemplo n.º 5
0
 class TMP_dict1(Plugin):
     declare_option("options", DictOption)
     declare_option("b")
     declare_option("c", default=3)
Exemplo n.º 6
0
 class TMP_float(Plugin):
     declare_option("o1", cls=FloatOption)
Exemplo n.º 7
0
 class TMP_int(Plugin):
     declare_option("o1", cls=IntOption)
Exemplo n.º 8
0
 class TMP_bool(Plugin):
     declare_option("o1", cls=BoolOption)
Exemplo n.º 9
0
 class TMP_repr(Plugin):
     declare_option("o1", default=4)
     declare_option("o2", section="foo", default=4)
Exemplo n.º 10
0
 class TMP_path(Plugin):
     declare_option("o1",
                    cls=FileOption,
                    default=o1_default,
                    directory="/dev/null")
Exemplo n.º 11
0
 class TMP_set_get1(Plugin):
     ep = ExtensionPoint(IDummyOption)
     declare_option("foo",
                    local_name="opt",
                    default=4,
                    cls=DummyOption1)
Exemplo n.º 12
0
 def __init__(self):
     declare_option("a")
     declare_option("b", cls=FileOption)
     declare_option("c")
     declare_option("xx", section_re='globals.*')
Exemplo n.º 13
0
 def __init__(self):
     declare_option("a")
     declare_option("b", local_name="bb")
     declare_option("b")
     declare_option("c")
     declare_option("zz", section='a.b')
     declare_option("yy", default="foo")
Exemplo n.º 14
0
    def __init__(self, namespace):
        """Initialize logging information for a specified namespace"""
        self._hdlr = None
        self.namespace = namespace
        self.env_plugins = ExtensionPoint(IEnvironmentConfig)
        if self.namespace == "":
            section = "logging"
            section_re = None
        else:
            section = "logging." + namespace
            section_re = "^logging$"
        #
        declare_option("timestamp",
                       section=section,
                       section_re=section_re,
                       default=False,
                       doc="""Add timestamp to logging information.""")
        #
        declare_option("log_dir",
                       section=section,
                       section_re=section_re,
                       default=None,
                       doc="""The logging directory.

        The default directory is the application directory plus 'log'.""")
        #
        declare_option("log_type",
                       section=section,
                       section_re=section_re,
                       default='none',
                       doc="""Logging facility to use.

        Should be one of (`none`, `file`, `stderr`, `syslog`, `winlog`).""")
        #
        declare_option(
            "log_file",
            section=section,
            section_re=section_re,
            default=namespace + '.log',
            doc=
            """If `log_type` is `file`, this should be a path to the log-file."""
        )
        #
        declare_option("log_level",
                       section=section,
                       section_re=section_re,
                       default='WARN',
                       doc="""Level of verbosity in log.

        Should be one of (`CRITICAL`, `ERROR`, `WARN`, `INFO`, `DEBUG`).""")
        #
        declare_option("log_format",
                       section=section,
                       section_re=section_re,
                       default=None,
                       doc="""Custom logging format.

        If nothing is set, the following will be used:

        $(project)[$(env) $(module)] $(levelname): $(message)

        In addition to regular key names supported by the Python logger library
        library (see http://docs.python.org/lib/node422.html), one could use:
         - $(path)s     the path for the current environment
         - $(basename)s the last path component of the current environment
         - $(app)s      the name of the current application

        Note the usage of `$(...)s` instead of `%(...)s` as the latter form
        would be interpreted by the ConfigParser itself.
        """)
Exemplo n.º 15
0
    def __init__(self, namespace):
        """Initialize logging information for a specified namespace"""
        self._hdlr = None
        self.namespace = namespace
        self.env_plugins = ExtensionPoint(IEnvironmentConfig)
        if self.namespace == "":
            section = "logging"
            section_re = None
        else:
            section = "logging." + namespace
            section_re = "^logging$"
        #
        declare_option(
            "timestamp",
            section=section,
            section_re=section_re,
            default=False,
            doc="""Add timestamp to logging information.""")
        #
        declare_option(
            "log_dir",
            section=section,
            section_re=section_re,
            default=None,
            doc="""The logging directory.

        The default directory is the application directory plus 'log'.""")
        #
        declare_option(
            "log_type",
            section=section,
            section_re=section_re,
            default='none',
            doc="""Logging facility to use.

        Should be one of (`none`, `file`, `stderr`, `syslog`, `winlog`).""")
        #
        declare_option(
            "log_file",
            section=section,
            section_re=section_re,
            default=namespace + '.log',
            doc="""If `log_type` is `file`, this should be a path to the log-file.""")
        #
        declare_option(
            "log_level",
            section=section,
            section_re=section_re,
            default='WARN',
            doc="""Level of verbosity in log.

        Should be one of (`CRITICAL`, `ERROR`, `WARN`, `INFO`, `DEBUG`).""")
        #
        declare_option(
            "log_format",
            section=section,
            section_re=section_re,
            default=None,
            doc="""Custom logging format.

        If nothing is set, the following will be used:

        $(project)[$(env) $(module)] $(levelname): $(message)

        In addition to regular key names supported by the Python logger library
        library (see http://docs.python.org/lib/node422.html), one could use:
         - $(path)s     the path for the current environment
         - $(basename)s the last path component of the current environment
         - $(app)s      the name of the current application

        Note the usage of `$(...)s` instead of `%(...)s` as the latter form
        would be interpreted by the ConfigParser itself.
        """)
Exemplo n.º 16
0
 def __init__(self):
     declare_option("a")
     declare_option("b", local_name="bb")
     declare_option("b")
     declare_option("c")
     declare_option("zz", section='a.b')
     declare_option("yy", default="foo")
Exemplo n.º 17
0
 def __init__(self):
     declare_option("a")
     declare_option("b", cls=FileOption)
     declare_option("c")
     declare_option("xx", section_re='globals.*')
Exemplo n.º 18
0
 def __init__(self, namespace):
     self.namespace = namespace
     self.p = re.compile(namespace)
     declare_option("options", cls=DictOption, section=namespace)
Exemplo n.º 19
0
 class TMP_OptionPlugin(Plugin):
     declare_option("o1")
Exemplo n.º 20
0
 class TMP_set_get2(Plugin):
     ep = ExtensionPoint(IOption)
     declare_option("foo", local_name="o1", default=4)
     declare_option("foo", local_name="o2", default=4)
Exemplo n.º 21
0
 def __init__(self, section):
     declare_option("o1", section=section, default=4)
Exemplo n.º 22
0
 def __init__(self, section):
     declare_option("o1", section=section, default=4)