from scaffold.core.widget import base_widget class control(base_widget): def create(self, title, url, method='post', enctype="", button='submit'): self.title = title self.url = url self.method = method self.button = button self.enctype = enctype self.content = [] return self def append(self, label, name, placeholder='', value='', input_type='text'): self.content.append((label, name, value, placeholder, input_type)) return self def render(self): htm='
' % (self.url, self.method) if self.title: htm += '%s' % self.title for label, name, value, placeholder, input_type in self.content: if input_type == 'hidden': htm+='' % (name, value) continue htm+='

' % (name, label, input_type ,name, placeholder, value) htm+='' % self.button htm+='
' return htm