def save(self): comp = Company.load(self.request.POST.get('company_id')) if not comp: comp = Company() comp.bind(self.request.POST) comp.save() comp.flush() #if not os.path.isdir(comp.web_full_directory): # comp.create_dir_structure() comp.clear_attributes() for i in range(10): attr_name = self.request.POST.get('attr_name[%d]' % i) attr_value = self.request.POST.get('attr_value[%d]' % i) if attr_name and attr_value: comp.set_attr(attr_name, attr_value) self.request.session.flash('Successfully saved %s.' % comp.name) return HTTPFound('/crm/company/edit/%s' % comp.company_id)