예제 #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'')
예제 #2
0
파일: markup.py 프로젝트: gaconnet/flatland
 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'')
예제 #3
0
파일: generic.py 프로젝트: Zeii2024/RL
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
예제 #4
0
파일: generic.py 프로젝트: yask123/final
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
예제 #5
0
파일: markup.py 프로젝트: dag/flatland
    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'')
예제 #6
0
파일: markup.py 프로젝트: mbr/flatland0
    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'')