Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(13)  |  Call(11)  |  Derive(0)  |  Import(2)
Factory for creating i18n messages.

src/s/c/sc.contentrules.localrole-1.0b2/src/sc/contentrules/localrole/action.py   sc.contentrules.localrole(Download)
from sc.contentrules.localrole.interfaces import ILocalRoleAction
 
from sc.contentrules.localrole import MessageFactory as _
 
 
    def summary(self):
        roles = ', '.join(self.roles)
        return _(u"Apply local roles ${roles} to ${principal}",
                 mapping=dict(role=[roles], principal=self.principal))
 
 
        if not principal:
            self.error(obj, _(u'No user or group found with the provided id.'))
            return False
 
    def error(self, obj, error):
        request = getattr(self.context, 'REQUEST', None)
        if request is not None:
            title = utils.pretty_title_or_id(obj, obj)
            message = _(u"Unable to apply local roles on ${name}: ${error}",
class LocalRoleAddForm(AddForm):
    """An add form for local roles action.
    """
    form_fields = form.FormFields(ILocalRoleAction)
    label = _(u"Add a Local Role Action")

src/s/c/sc.contentrules.localrole-1.0b2/src/sc/contentrules/localrole/interfaces.py   sc.contentrules.localrole(Download)
from zope.schema import TextLine
 
from sc.contentrules.localrole import MessageFactory as _
 
 
class ILocalRoleAction(Interface):
    """An action used to apply a local role to an object
    """
 
    principal = TextLine(title=_(u"Username / Group name"),
 
    principal = TextLine(title=_(u"Username / Group name"),
                         description=_(u"Please inform the username or "
                                       u"groupname that will be used by "
                                       u"this action.  Use  ${title} in "
                                       u"this field to use the content "
                                       u"title as the value for this field."),
                         required=True)
 
    roles = Set(title=_(u"Roles"),
 
    roles = Set(title=_(u"Roles"),
                description=_(u"Roles to be assigned to user/group "
                              u"in the object."),
                required=True,