示例#1
0
 def bind_test5(self, ctx):
     return annotate.MethodBinding(
         'test5',
         annotate.Method(arguments=[
             annotate.Argument('foo', annotate.String()),
             annotate.Argument('bar', annotate.Integer())
         ]))
示例#2
0
        class FormPage(rend.Page):
            bind_test1 = defer.succeed([('foo', annotate.String()),
                                        ('bar', annotate.Integer())])
            bind_test2 = defer.succeed(
                annotate.MethodBinding(
                    'test2',
                    annotate.Method(arguments=[
                        annotate.Argument('foo', annotate.String())
                    ])))

            bind_test3 = defer.succeed(
                annotate.Property('test3', annotate.Integer()))

            def bind_test4(self, ctx):
                return defer.succeed([('foo', annotate.String()),
                                      ('bar', annotate.Integer())])

            def bind_test5(self, ctx):
                return defer.succeed(
                    annotate.MethodBinding(
                        'test5',
                        annotate.Method(arguments=[
                            annotate.Argument('foo', annotate.String()),
                            annotate.Argument('bar', annotate.Integer())
                        ])))

            docFactory = loaders.stan(html[freeform.renderForms()])
示例#3
0
 def _convert_list(binding):
     if isinstance(binding, list):
         binding = annotate.MethodBinding(
             name, annotate.Method(arguments=[
             annotate.Argument(n, v, v.id)
             for (n, v) in binding]))
     return binding
示例#4
0
 def bind_delete(self, ctx):
     return annotate.MethodBinding(
         'delete',
         annotate.Method(arguments=[
             annotate.Argument('ctx', annotate.Context()),
         ],
                         label=_('Confirm delete')),
         action=_('Delete'))
示例#5
0
 def _bind(ctx):
     return annotate.MethodBinding('action_' + name,
                                   annotate.Method(arguments=[
                                       annotate.Argument(*field)
                                       for field in fields
                                   ],
                                                   label=desc),
                                   action=btnlabel)
示例#6
0
 def bind_remove(self, ctx):
     return annotate.MethodBinding('remove',
                                   annotate.Method(arguments=[
                                       annotate.Argument(
                                           'ctx', annotate.Context()),
                                   ],
                                                   label=_('Remove')),
                                   action=_('Remove'))
示例#7
0
 def bind_generateRandom(self, ctx):
     return annotate.MethodBinding(
         'generateRandom',
         annotate.Method(arguments=[
             annotate.Argument('ctx', annotate.Context()),
         ],
                         label=_('Generate random')),
         action=_('Generate random'))
示例#8
0
文件: search.py 项目: Jbran77/ldaptor
 def bind_cancel(self, ctx):
     return annotate.MethodBinding(
         'cancel',
         annotate.Method(arguments=[
         annotate.Argument('context', annotate.Context()),
         ],
                         label=_('Cancel')),
         action=_('Cancel'))
示例#9
0
 def bind_animals(self, ctx, ):
     """Add Animal"""
     return annotate.MethodBinding(
             'animals',
             annotate.Method(arguments=
                 [annotate.Argument('animal', annotate.String()),
                  annotate.Argument('description', annotate.Text())]),
             action="Add Animal",
                                   )
示例#10
0
 def bind_add(self, ctx):
     return annotate.MethodBinding(
         'add',
         annotate.Method(arguments=[
             annotate.Argument('context', annotate.Context()),
             annotate.Argument('smartObjectClass',
                               annotate.Choice(choices=self.plugins)),
         ],
                         label=_('Add')),
         action=_('Add'))
示例#11
0
 def bind_go(self, ctx):
     return annotate.MethodBinding(
         'go',
         annotate.Method(arguments=[
             annotate.Argument('ctx', annotate.Context()),
             annotate.Argument(
                 'baseDN',
                 LDAPDN(label=_('Base DN'),
                        description=_(
                            "The top-level LDAP DN you want"
                            " to browse, e.g. dc=example,dc=com"))),
         ],
                         label=_('Go')),
         action=_('Go'))
示例#12
0
 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'))
示例#13
0
 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'))
示例#14
0
文件: search.py 项目: Jbran77/ldaptor
    def bind_search(self, ctx):
        l = []
        l.append(annotate.Argument('ctx', annotate.Context()))
        for field in config.getSearchFieldNames():
            l.append(annotate.Argument('search_%s' % field,
                                       annotate.String(label=field)))
        l.append(annotate.Argument('searchfilter',
                                   annotate.String(label=_("Advanced search"))))
        l.append(annotate.Argument(
            'scope',
            annotate.Choice(label=_("Search depth"),
                            choices=[ pureldap.LDAP_SCOPE_wholeSubtree,
                                      pureldap.LDAP_SCOPE_singleLevel,
                                      pureldap.LDAP_SCOPE_baseObject,
                                      ],
                            stringify=strScope,
                            default=pureldap.LDAP_SCOPE_wholeSubtree)))

        return annotate.MethodBinding(
            name='search',
            action=_("Search"),
            typeValue=annotate.Method(arguments=l,
                                      label=_('Search')))
示例#15
0
 def bind_generate(self, ctx):
     return annotate.MethodBinding('generatePasswords',
                                   annotate.Method(
                                       arguments=self.formFields,
                                       label=_('Generate passwords')),
                                   action=_('Generate passwords'))
示例#16
0
 def bind_form(self, ctx):
     return annotate.MethodBinding(
         'action', annotate.Method(arguments=self.formElements))
示例#17
0
 def bind_add(self, ctx):
     return annotate.MethodBinding('add',
                                   annotate.Method(
                                       arguments=self.formFields,
                                       label=_('Add')),
                                   action=_('Add'))