def __init__(self, filestore, show_file_preview=True, show_download_link=False, show_image_thumbnail=False, url_base=None, css_class=None, image_thumbnail_default=None, single=False, filestore_path=''): """ Changes from the default implementation: - require ``filestore`` argument (no default) - we don't use any ``url_ident_factory`` - ``single`` argument - ``filestore_path`` argument - add ``self.from_filestore`` flag which will tell the template when we're dealing with a temp file coming from the filestore """ # Setup defaults. if url_base is None: url_base = '/filehandler' # Initialise instance state Widget.__init__(self) self.filestore = filestore self.show_image_thumbnail = show_image_thumbnail self.image_thumbnail_default = image_thumbnail_default self.url_base = url_base self.show_download_link = show_download_link self.show_file_preview = show_file_preview self.single = single self.filestore_path = filestore_path self.from_filestore = False
def test_set_widget(self): import schemaish from formish.widgets import Widget class DummySchema(schemaish.Structure): title = schemaish.String() form = self._makeOne(DummySchema()) widget = Widget() form.set_widget('title', widget) self.assertEqual(form['title'].widget.widget, widget)
def __init__(self, **kw): self.tagdata = kw.pop('tagdata', {'records':[]}) Widget.__init__(self, **kw)
def __init__(self, **kw): self.tagdata = kw.pop('tagdata', {'records': []}) Widget.__init__(self, **kw)
def __init__(self, **kw): self.tagdata = kw.pop("tagdata", {"records": []}) Widget.__init__(self, **kw)