def _getFormFields(self): r = [] r.append(annotate.Argument('request', annotate.Request())) for dn, e in self.ldapObjects.items(): r.append( annotate.Argument('dn_%s' % dn, annotate.Boolean(label=dn, description=e))) return r
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
def fwd(self, req=annotate.Request(), name=annotate.String(label="Configuration Name"), username=annotate.String(), password=annotate.PasswordEntry()): """Free World Dialup Account Add a configuration for a FWD account. """ pass
def divmod(self, req=annotate.Request(), name=annotate.String(label="Configuration Name"), username=annotate.String(), password=annotate.PasswordEntry()): """Divmod Account Add a configuration for a Divmod account. """ pass
def editPasting(request=annotate.Request(), postedBy=annotate.String(immutable=1), author=annotate.String(strip=True), text=annotate.Text(strip=True, required=True)): pass
def addPasting(request=annotate.Request(), author=annotate.String(strip=True), text=annotate.Text(strip=True, required=True)): pass