예제 #1
0
 def login(ctx=annotate.Context(),
           userName=annotate.String(
               required=True, requiredFailMessage='Please enter your name'),
           password=annotate.PasswordEntry(
               required=True,
               requiredFailMessage='Please enter your name')):
     pass
예제 #2
0
 def insert(ctx = annotate.Context(),
            title = annotate.String(),
            author = annotate.String(),
            image = annotate.FileUpload(required=True,
                                        requiredFailMessage="Must upload something")
            ):
     """ Insert a new image """
예제 #3
0
 def doSomething(
         ctx=annotate.Context(),
         fee=annotate.String(required=True, description="Wee!"),
         fi=annotate.Integer(description="Tra-la-la"),
         fo=annotate.Text(),
         fum=annotate.String(),
 ):
     """Do Something Really Exciting
예제 #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
파일: 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'))
예제 #6
0
 def bind_generateRandom(self, ctx):
     return annotate.MethodBinding(
         'generateRandom',
         annotate.Method(arguments=[
             annotate.Argument('ctx', annotate.Context()),
         ],
                         label=_('Generate random')),
         action=_('Generate random'))
예제 #7
0
 def bind_remove(self, ctx):
     return annotate.MethodBinding('remove',
                                   annotate.Method(arguments=[
                                       annotate.Argument(
                                           'ctx', annotate.Context()),
                                   ],
                                                   label=_('Remove')),
                                   action=_('Remove'))
예제 #8
0
    def _getFormFields(self):
        r = []
        r.append(annotate.Argument('context', annotate.Context()))

        process = {}

        # TODO sort objectclasses somehow?
        objectClasses = list(self.chosenObjectClasses)
        objectClassesSeen = {}

        self.nonUserEditableAttributes = []
        while objectClasses:
            objectClass = objectClasses.pop()
            objclassName = objectClass.name[0]

            if objectClassesSeen.has_key(objclassName):
                continue
            objectClassesSeen[objclassName] = 1

            for ocName in objectClass.sup or []:
                objclass = mapNameToObjectClass(self.objectClasses, ocName)
                assert objclass, "Objectclass %s must have schema" % objclassName
                objectClasses.append(objclass)

            for attr_alias in objectClass.must:
                real_attr = self._get_attrtype(str(attr_alias))

                if hasattr(self, 'nonUserEditableAttributeType_' +
                           real_attr.name[0]):
                    self.nonUserEditableAttributes.append(real_attr.name[0])
                else:
                    for attr in real_attr.name:
                        if not process.has_key(attr.upper()):
                            process[attr.upper()] = 0
                        if not process[attr.upper()]:
                            self._one_formfield(attr, result=r, must=True)
                        for name in real_attr.name:
                            process[name.upper()] = 1

            for attr_alias in objectClass.may:
                real_attr = self._get_attrtype(str(attr_alias))

                if hasattr(self, 'nonUserEditableAttributeType_' +
                           real_attr.name[0]):
                    self.nonUserEditableAttributes.append(real_attr.name[0])
                else:
                    for attr in real_attr.name:
                        if not process.has_key(attr.upper()):
                            process[attr.upper()] = 0
                        if not process[attr.upper()]:
                            self._one_formfield(attr, result=r)
                        for name in real_attr.name:
                            process[name.upper()] = 1

        assert [v == 1 for k, v in process.items()], "TODO: %s" % process
        return r
예제 #9
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'))
예제 #10
0
 def insert(
     ctx = annotate.Context(),
     title = annotate.String(strip=True, required=True, \
                             requiredFailMessage="Title must be provided", tabindex='1'),
     author = annotate.String(strip=True, default="Anonymous", tabindex='2'),
     id = annotate.String(hidden=True),
     category = annotate.Choice(categories, tabindex='3'),
     content = annotate.Text(required=True, \
                             requiredFailMessage="Posts with no content are not allowed", tabindex='4'),
     ):
     pass
예제 #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 __init__(self, objectClasses):
        super(AddOCForm, self).__init__(None)
        structural = []
        auxiliary = []
        for oc in objectClasses:
            if oc.type == 'STRUCTURAL':
                structural.append(oc)
            elif oc.type == 'AUXILIARY':
                auxiliary.append(oc)
        structural.sort()
        auxiliary.sort()

        class KludgeNevowChoice(object):
            """
            A kludge that allows using Choice with both Nevow 0.3 and
            newer.
            """
            def __init__(self, oc):
                self.name = oc.name
                self.desc = oc.desc

            def __str__(self):
                """
                For Choice in Nevow 0.4 and newer. Nevow 0.3 will use
                integer indexes. Actual stringification for display
                purposes happens in strObjectClass.
                """
                return self.name[0]

        formFields = [
            annotate.Argument('ctx', annotate.Context()),
            annotate.Argument('request', annotate.Request()),
            annotate.Argument(
                'structuralObjectClass',
                annotate.Choice(
                    label=_('Object type to create'),
                    choices=[KludgeNevowChoice(x) for x in structural],
                    stringify=strObjectClass)),
        ]
        for oc in auxiliary:
            formFields.append(
                annotate.Argument(
                    'auxiliary_%s' % oc.name[0],
                    annotate.Boolean(label=oc.name[0],
                                     description=oc.desc or '')))
        self.formFields = formFields
예제 #14
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'))
예제 #15
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')))
예제 #16
0
 def insert(ctx=annotate.Context(),
            description=annotate.String(
                required=True, requiredFailMessage="Description Missing")):
     pass
예제 #17
0
 def update(ctx=annotate.Context(),
            id=annotate.Integer(),
            oldstate=annotate.Integer()):
     pass
예제 #18
0
 def delete(ctx=annotate.Context(), id=annotate.Integer()):
     pass
예제 #19
0
파일: wiki.py 프로젝트: nanonyme/pgasync
 def updateWiki(self,
                ctx=annotate.Context(),
                text=annotate.Text(),
                new=annotate.String(hidden=True)):
     pass
예제 #20
0
 def stopServer(self, ctx=annotate.Context()):
     pass
예제 #21
0
 def kickUser(self,
              ctx=annotate.Context(),
              username=annotate.String(required=True)):
     pass
예제 #22
0
 def deleteGame(self,
                ctx=annotate.Context(),
                gameId=annotate.String(required=True)):
     pass
예제 #23
0
 def modifyUser(self,
                ctx=annotate.Context(),
                oldPassword=annotate.PasswordEntry(),
                password=annotate.Password(),
                isAdministrator=isAdmin):
     pass
예제 #24
0
 def addNewBulletin(self,
                    ctx=annotate.Context(),
                    message=annotate.String(required=True)):
     pass
예제 #25
0
 def resetRank(self, ctx=annotate.Context()):
     pass
예제 #26
0
 def sendLogMessage(ctx=annotate.Context(),
                    level=annotate.Choice(LogLevels,
                                          required=True,
                                          label=_("Log message level")),
                    message=annotate.String(label=_("Message text"))):
     pass
예제 #27
0
 def deleteBulletin(self,
                    ctx=annotate.Context(),
                    bulletinId=annotate.String(required=True)):
     pass