Esempio n. 1
0
    """ Marshal variables for html forms.
    """
    vars = []
    for key, converter, value in complex_marshal(kw.items()):
        vars.append((key + converter, escape(str(value))))
    return tuple(vars)


security.declarePublic('toUnicode')


def toUnicode(value, charset=None):
    """ Convert value to unicode.
    """
    if isinstance(value, str):
        return charset and unicode(value, charset) or unicode(value)
    elif isinstance(value, list):
        return [toUnicode(val, charset) for val in value]
    elif isinstance(value, tuple):
        return tuple([toUnicode(val, charset) for val in value])
    elif isinstance(value, dict):
        for key, val in value.items():
            value[key] = toUnicode(val, charset)
        return value
    else:
        return value


security.declarePublic('MessageID')
MessageID = MessageIDFactory('cmf_default')
Esempio n. 2
0
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; see the file COPYING. If not, write to the
## Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
"""
Zope 3.1-style messagefactory module for Zope <= 2.9 (Zope 3.1)

BBB: Zope 2.8 / Zope X3.0
"""
__version__ = "$Revision: 1.31 $"
# $Source: /cvsroot/ingeniweb/PloneSubscription/SubscriptionTool.py,v $
# $Id: SubscriptionTool.py,v 1.31 2005/10/10 20:43:57 encolpe Exp $
__docformat__ = 'restructuredtext'


from zope.i18nmessageid import MessageIDFactory
msg_factory = MessageIDFactory('cmfplacefulworkflow')

def CMFPlacefulWorkflowMessageFactory(ustr, default=None, mapping=None):
    message = msg_factory(ustr, default)
    if mapping is not None:
        message.mapping.update(mapping)
    return message
#
# Zope 3.1-style messagefactory module for Zope <= 2.9 (Zope 3.1)
#

# BBB: Zope 2.8 / Zope X3.0
from zope.i18nmessageid import MessageIDFactory
msg_factory = MessageIDFactory('salesforcepfgadapter')


def SalesforcePFGAdapterMessageFactory(ustr, default=None, mapping=None):
    message = msg_factory(ustr, default)
    if mapping is not None:
        message.mapping.update(mapping)
    return message
Esempio n. 4
0
##############################################################################
#
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
""" Utility functions.

$Id$
"""

from AccessControl import ModuleSecurityInfo
from zope.i18nmessageid import MessageIDFactory

security = ModuleSecurityInfo('Products.CMFCalendar.utils')

security.declarePublic('MessageID')
MessageID = MessageIDFactory('cmf_calendar')
Esempio n. 5
0
#   The Plone Content Management System is built on the Content
#   Management Framework (CMF) and the Zope Application Server.
#   Plone is copyright 2000-2006 Plone Foundation et al.
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
# Zope 3.1-style messagefactory module for Zope <= 2.9 (Zope 3.1)
#

# BBB: Zope 2.8 / Zope X3.0

from zope.i18nmessageid import MessageIDFactory
msg_factory = MessageIDFactory('plonearticle')


def ArticleMessageFactory(ustr, default=None, mapping=None):
    message = msg_factory(ustr, default)
    if mapping is not None:
        message.mapping.update(mapping)
    return message


model_msg_factory = MessageIDFactory('plonearticle-model')


def ModelMessageFactory(ustr, default=None, mapping=None):
    message = model_msg_factory(ustr, default)
    if mapping is not None:
#
# Zope 3.1-style messagefactory module for Zope <= 2.9 (Zope 3.1)
#

# BBB: Zope 2.8 / Zope X3.0

from zope.i18nmessageid import MessageIDFactory
msg_factory = MessageIDFactory('rhaptos')


def RhaptosMessageFactory(ustr, default=None, mapping=None):
    message = msg_factory(ustr, default)
    if mapping is not None:
        message.mapping.update(mapping)
    return message
Esempio n. 7
0
#
# Zope 3.1-style messagefactory module for Zope <= 2.9 (Zope 3.1)
#

# BBB: Zope 2.8 / Zope X3.0
from zope.i18nmessageid import MessageIDFactory
msg_factory = MessageIDFactory('ploneformgen')


def PloneFormGenMessageFactory(ustr, default=None, mapping=None):
    message = msg_factory(ustr, default)
    if mapping is not None:
        message.mapping.update(mapping)
    return message
Esempio n. 8
0
#
##############################################################################
"""Demo schema content

$Id$
"""
from OFS.SimpleItem import SimpleItem
from Globals import InitializeClass

from zope.i18nmessageid import MessageIDFactory
from zope.interface import implements, Interface
from zope.schema import TextLine, Text, Object, Int, List
from zope.app.form import CustomWidgetFactory
from zope.app.form.browser import ObjectWidget

_ = MessageIDFactory('formtest')


class IFieldContent(Interface):

    title = TextLine(title=_(u"Title"),
                     description=_(u"A short description of the event."),
                     default=u"",
                     required=True)

    description = Text(title=_(u"Description"),
                       description=_(u"A long description of the event."),
                       default=u"",
                       required=False)

    somenumber = Int(title=_(u"Some number"), default=0, required=False)