Пример #1
0
from Products.CMFDefault.formlib.widgets import TextInputWidget
from Products.CMFDefault.interfaces import IMutableDocument
from Products.CMFDefault.utils import Message as _

from Products.CMFDefault.browser.utils import decode, memoize, ViewBase

available_text_formats = ((u'structured-text', 'structured-text',
                           _(u'structured-text')), (u'plain', 'plain',
                                                    _(u'plain text')),
                          (u'html', 'html', _(u'html')))

if REST_AVAILABLE:
    available_text_formats += ((u'restructured-text', 'restructured-text',
                                _(u'restructured-text')), )

TextFormatVocabularyFactory = StaticVocabulary(available_text_formats)


class IDocumentSchema(Interface):
    """Schema for document views.
    """

    safety_belt = ASCIILine(required=False)

    title = TextLine(title=_(u'Title'), readonly=True)

    description = Text(title=_(u'Description'), readonly=True)

    text_format = Choice(title=_(u'Format'),
                         vocabulary='cmf.AvailableTextFormats')
Пример #2
0
    """
    Storages for particular form fields.
    """
    section_choice = set()
    last_triggered = ProxyFieldProperty(IStaticDeployment['last_triggered'])
    delete_previous = False
    deployment = False


# Vocabularies
available_deployment_modes = (
    (u'full_deployment', 'full_deployment', _(u'Full deployment')),
    (u'update_deployment', 'update_deployment', _(u'Update deployment')),
)

DeploymentModeVocabularyFactory = StaticVocabulary(available_deployment_modes)


class ConfigSectionsVocabulary(object):
    """
    Vocabulary containing all sections defined in config file
    """
    implements(IVocabularyFactory)

    def __call__(self, context):
        """
        """
        config_path = os.path.normpath(get_config_path())
        config_file = open(config_path, 'r')
        config_parser = ConfigParser()
        try: