How to use the ldaptor.apps.webui.i18n._ function in ldaptor

To help you get started, we’ve selected a few ldaptor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twisted / ldaptor / ldaptor / apps / webui / edit.py View on Github external
pass
                    if not possible:
                        raise ldapsyntax.CannotRemoveRDNError \
                              (rdn.attributeType,
                               rdn.value)
                    newRDN.append(distinguishedname.LDAPAttributeTypeAndValue(attributeType=attr,
                                                                              value=possible[0]))
                    old.remove(rdn.value)
                    try:
                        new.remove(possible[0])
                    except ValueError:
                        pass
        if newRDN is not None:
            newRDN = distinguishedname.RelativeDistinguishedName(newRDN)
            changes_desc[tags.li[
                _("changing %s: changing RDN to say %s") \
                %(repr(attr), newRDN)]]
            newDN = distinguishedname.DistinguishedName(
                (newRDN,)+self.entry.dn.split()[1:]
                )
            def _move(_):
                return self.entry.move(newDN)
            d.addCallback(_move)
            def _redirect(r, ctx, newDN):
                request = inevow.IRequest(ctx)
                u = url.URL.fromContext(ctx).curdir()
                u = u.child(uriQuote(newDN))
                request.setComponent(iformless.IRedirectAfterPost, u)
                return r
            d.addCallback(_redirect, context, newDN)

        for attr,old,new in changes:
github twisted / ldaptor / ldaptor / apps / webui / change_password.py View on Github external
def bind_setPassword(self, ctx):
        return annotate.MethodBinding(
            'setPassword',
            annotate.Method(arguments=[
            annotate.Argument('ctx', annotate.Context()),
            annotate.Argument('newPassword', annotate.PasswordEntry(required=True,
                                                                    label=_('New password'))),
            annotate.Argument('again', annotate.PasswordEntry(required=True,
                                                              label=_('Again'))),
            ],
                            label=_('Set password')),
            action=_('Set password'))
github twisted / ldaptor / ldaptor / apps / webui / change_password.py View on Github external
def bind_setServicePassword(self, ctx):
        return annotate.MethodBinding(
            'setServicePassword',
            annotate.Method(arguments=[
            annotate.Argument('ctx', annotate.Context()),
            annotate.Argument('newPassword', annotate.PasswordEntry(required=True,
                                                                    label=_('New password'))),
            annotate.Argument('again', annotate.PasswordEntry(required=True,
                                                              label=_('Again'))),
            ],
                            label=_('Set password')),
            action=_('Set password'))
github twisted / ldaptor / ldaptor / apps / webui / change_password.py View on Github external
def _report(name):
            return _('Set password for service %r') % name
        d.addCallback(_report)
github twisted / ldaptor / ldaptor / apps / webui / add.py View on Github external
if e is None:
            return context.tag.clear()[obj]

        u=url.URL.fromContext(context)
        u=u.parentdir().parentdir().parentdir().clear()

        return context.tag.clear()[
            _("Added "),
            tags.a(href=u.parentdir().child(e.dn).child("search"))[e.dn],
            _(" successfully. "),

            # TODO share implementation with entryLinks
            '[',
            tags.a(href=u.sibling('edit').child(uriQuote(e.dn)))[_('edit')],
            '|',
            tags.a(href=u.sibling('move').child(uriQuote(e.dn)))[_('move')],
            '|',
            tags.a(href=u.sibling('delete').child(uriQuote(e.dn)))[_('delete')],
            '|',
            tags.a(href=u.sibling('change_password').child(uriQuote(e.dn)))[_('change password')],
            ']',
            ]
github twisted / ldaptor / ldaptor / apps / webui / change_password.py View on Github external
def bind_add(self, ctx):
        return annotate.MethodBinding(
            'add',
            annotate.Method(arguments=[
            annotate.Argument('ctx', annotate.Context()),
            annotate.Argument('serviceName', annotate.String(required=True,
                                                             label=_('Service name'))),
            annotate.Argument('newPassword', annotate.PasswordEntry(required=False,
                                                                    label=_('New password'),
                                                                    description=_("Leave empty to generate random password."))),
            annotate.Argument('again', annotate.PasswordEntry(required=False,
                                                              label=_('Again'))),
            ],
                            label=_('Add')),
            action=_('Add'))
github twisted / ldaptor / ldaptor / apps / webui / change_password.py View on Github external
def bind_remove(self, ctx):
        return annotate.MethodBinding(
            'remove',
            annotate.Method(arguments=[
            annotate.Argument('ctx', annotate.Context()),
            ],
                            label=_('Remove')),
            action=_('Remove'))
github twisted / ldaptor / ldaptor / apps / webui / change_password.py View on Github external
def checkPasswordTypos(newPassword, again):
    if newPassword != again:
        raise annotate.ValidateError(
            {},
            formErrorMessage=_('Passwords do not match.'))
github twisted / ldaptor / ldaptor / apps / webui / search.py View on Github external
def cancel(self, context):
        self._remove(context)
        return _('Cancelled move of %s') % self.original.dn
github twisted / ldaptor / ldaptor / apps / webui / add.py View on Github external
u=url.URL.fromContext(context)
        u=u.parentdir().parentdir().parentdir().clear()

        return context.tag.clear()[
            _("Added "),
            tags.a(href=u.parentdir().child(e.dn).child("search"))[e.dn],
            _(" successfully. "),

            # TODO share implementation with entryLinks
            '[',
            tags.a(href=u.sibling('edit').child(uriQuote(e.dn)))[_('edit')],
            '|',
            tags.a(href=u.sibling('move').child(uriQuote(e.dn)))[_('move')],
            '|',
            tags.a(href=u.sibling('delete').child(uriQuote(e.dn)))[_('delete')],
            '|',
            tags.a(href=u.sibling('change_password').child(uriQuote(e.dn)))[_('change password')],
            ']',
            ]