def edit(self): buttons = [tag_for('input', Type='submit', Class='button', name=name_for(caption + ' button'), id=name_for(caption + ' button'), value=caption) for caption in self.captions] if hasattr(self,'cancel'): buttons.append(tag_for('a', 'cancel', href=getattr(self,'cancel','cancel'))) return layout_field(' ',' '.join(buttons))
def __getattr__(self,name): if name == 'name' and hasattr(self,'label'): return name_for(self.label) raise AttributeError