code: def edit_form(self, obj=None):
          
          kbtype = request.args['kbtype'] if 'kbtype' in request.args else 'w'
  
          if kbtype == KnwKB.KNWKB_TYPES['written_as']:
              self.form = WrittenAsKnowledgeForm
          elif kbtype == KnwKB.KNWKB_TYPES['dynamic']:
              self.form = DynamicKnowledgeForm
          else:
              self.form = TaxonomyKnowledgeForm
  
          form = self.form(obj=obj)
  
          if not form.is_submitted():
              # load extra data: obj => form
              if kbtype == KnwKB.KNWKB_TYPES['dynamic']:
                  if obj.kbdefs:
                      form.id_collection.data = obj.kbdefs.id_collection
                      form.output_tag.data = obj.kbdefs.output_tag
                      form.search_expression.data = obj.kbdefs.search_expression
  
              if kbtype == KnwKB.KNWKB_TYPES['taxonomy']:
                  file_name = obj.get_filename()
                  if os.path.isfile(file_name):
                      form.tfile.label.text = form.tfile.label.text + " *"
                      # TODO add the possibility to download the file
                      form.tfile.description = _("Already uploaded %(name)s",
                                                 name=obj.get_filename())
  
          form.kbtype.data = kbtype
  
          return form
docs: Edit form.