Beispiel #1
0
 def set(self, **settings):
     for key, value in settings.items():
         if key not in self:
             raise TypeError("%r is not a valid argument." % key)
         if key.startswith('auto_'):
             value = parse_trool(value)
         self[key] = value
     return self['markup_wrapper'](u'')
Beispiel #2
0
 def set(self, **settings):
     for key, value in settings.items():
         if key not in self:
             raise TypeError(
                 "%r is not a valid argument." % key)
         if key.startswith('auto_'):
             value = parse_trool(value)
         self[key] = value
     return self['markup_wrapper'](u'')
Beispiel #3
0
def _pop_toggle(key, attributes, context):
    """Remove *key* from *attributes*, if present and report its status.

    Returns the effective value of *key* by considering it's troolean value in
    relation to the default value in *context*.  If *key* is present in the
    attributes and was True, the setting is considered to be 'forced', a
    situation with higher weight than simply defaulting to True via the
    context.

    :returns: a 2-tuple of boolean effective value and boolean forced.

    """
    value = parse_trool(attributes.pop(key, Maybe))
    forced = value is True  # setting key="on" is a "forced" setting
    if value is Maybe:
        value = parse_trool(context[key])
    if value is Maybe:
        value = _default_context[key]
    return value, forced
Beispiel #4
0
def _pop_toggle(key, attributes, context):
    """Remove *key* from *attributes*, if present and report its status.

    Returns the effective value of *key* by considering it's troolean value in
    relation to the default value in *context*.  If *key* is present in the
    attributes and was True, the setting is considered to be 'forced', a
    situation with higher weight than simply defaulting to True via the
    context.

    :returns: a 2-tuple of boolean effective value and boolean forced.

    """
    value = parse_trool(attributes.pop(key, Maybe))
    forced = value is True  # setting key="on" is a "forced" setting
    if value is Maybe:
        value = parse_trool(context[key])
    if value is Maybe:
        value = _default_context[key]
    return value, forced
Beispiel #5
0
    def set(self, **settings):
        """Change the :ref:`markupsettings` in effect.

        Change the \*\*settings in the current scope.  Changes remain in
        effect until another :meth:`set` or a :meth:`end` ends the current
        scope.

        """

        for key, value in settings.items():
            if key not in self:
                raise TypeError("%r is not a valid argument." % key)
            if key.startswith('auto_'):
                value = parse_trool(value)
            self[key] = value
        return self['markup_wrapper'](u'')
Beispiel #6
0
    def set(self, **settings):
        """Change the :ref:`markupsettings` in effect.

        Change the \*\*settings in the current scope.  Changes remain in
        effect until another :meth:`set` or a :meth:`end` ends the current
        scope.

        """

        for key, value in settings.items():
            if key not in self:
                raise TypeError(
                    "%r is not a valid argument." % key)
            if key.startswith('auto_'):
                value = parse_trool(value)
            self[key] = value
        return self['markup_wrapper'](u'')