Logo Search packages:      
Sourcecode: zope-atseng version File versions  Download package

def ATSchemaEditorNG::SchemaEditor::SchemaEditor::atse_addField (   self,
  schema_id,
  schemata,
  schema_template,
  name,
  RESPONSE = None 
)

create a new field

Definition at line 429 of file SchemaEditor.py.

                                          :
        """create a new field"""
        S = self.atse_getSchemaById(schema_id)

        if not name:
            raise SchemaEditorError(self.translate('atse_empty_field_name', 
                                            default='Field name is empty',
                                            domain='ATSchemaEditorNG'))

        if not id_regex.match( name ):
            raise SchemaEditorError(self.translate('atse_not_a_valid_id', 
                                            {'id' : name},
                                            default='\"$id\" is not a valid ID',
                                            domain='ATSchemaEditorNG'))

        if name in [f.getName() for f in S.fields()]:
            raise SchemaEditorError(self.translate('atse_field_already_exists', 
                                           {'id' : name},
                                           default='\"$id\" already exists',
                                           domain='ATSchemaEditorNG'))

        fieldset = schemata    
        field = StringField(name, schemata=fieldset, widget=StringWidget)
        S.addField(field)
        self._schemas[schema_id] = S
        if RESPONSE:        
            util.redirect(RESPONSE, schema_template,
                          self.translate('atse_field_added', 
                                         default='Field added',
                                         domain='ATSchemaEditorNG'), 
                          schema_id=schema_id,
                          schemata=fieldset, 
                          field=name)
        return            
        
    security.declareProtected(ManageSchemaPermission, 'atse_update')
    def atse_update(self, schema_id, schema_template, fielddata,


Generated by  Doxygen 1.6.0   Back to index